diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 7ec2a6bf69..43a3993eee 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index af102bf96e..92acd73ace 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -43,7 +43,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -76,7 +76,7 @@ jobs: with: languages: "cpp" - name: Setup Build - run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=false chip_data_model_check_die_on_failure=true" + run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=false" - name: Run Build run: scripts/run_in_build_env.sh "ninja -C ./out" - name: Run Tests @@ -139,7 +139,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -183,7 +183,7 @@ jobs: scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" - name: Setup Build, Run Build and Run Tests run: | - BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false chip_data_model_check_die_on_failure=true" + BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false" scripts/run_in_build_env.sh "ninja -C ./out/gcc_release" BUILD_TYPE=gcc_release scripts/tests/gn_tests.sh - name: Clean output @@ -205,14 +205,14 @@ jobs: esac rm -rf ./out/sanitizers - BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands + BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS" --add-export-compile-commands=* BUILD_TYPE=sanitizers scripts/tests/gn_tests.sh done - name: Generate tests with sanitizers (for tidy) if: github.event.pull_request.number != null run: | rm -rf ./out/sanitizers - BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="is_clang=true is_asan=true chip_data_model_check_die_on_failure=true" --export-compile-commands + BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="is_clang=true is_asan=true" --add-export-compile-commands=* - name: Ensure codegen is done for sanitize run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/sanitizers" @@ -308,7 +308,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -333,7 +333,7 @@ jobs: - name: Setup Build, Run Build and Run Tests run: | - scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false chip_data_model_check_die_on_failure=true" + scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false" scripts/run_in_build_env.sh "ninja -C ./out" scripts/tests/gn_tests.sh - name: Setup test python environment @@ -371,7 +371,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -439,7 +439,7 @@ jobs: # We want to build various standalone example apps (similar to what examples-linux-standalone.yaml # does), so use target_os="all" to get those picked up as part of the "unified" build. But then # to save CI resources we want to exclude the "host clang" build, which uses the pigweed clang. - scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false chip_data_model_check_die_on_failure=true' --export-compile-commands + scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false' --add-export-compile-commands=* scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" scripts/tests/gn_tests.sh - name: Ensure codegen is done for default @@ -490,7 +490,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index a1e5907cb9..d7360f6cc4 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 options: --user root steps: @@ -57,7 +57,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:90 options: --user root steps: @@ -78,7 +78,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:81 + image: ghcr.io/project-chip/chip-build-nrf-platform:90 options: --user root steps: @@ -99,7 +99,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:81 + image: ghcr.io/project-chip/chip-build-telink:90 options: --user root steps: @@ -111,7 +111,7 @@ jobs: platform: telink # - name: Update Zephyr to specific revision (for developers purpose) # shell: bash - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 3ed7686a9378de6be1368c912f9a42f998bbfb18" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py f762f1a1027284e63e338e6d83deeade62f355b0" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 9dc5bbab1a..e345ff2a75 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -84,7 +84,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:81 + image: ghcr.io/project-chip/chip-build-doxygen:90 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 1c87787cf6..a4b40a1933 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:81 + image: ghcr.io/project-chip/chip-build-ameba:90 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 7597ef1783..143ce3364f 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:81 + image: ghcr.io/project-chip/chip-build-asr:90 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 9a51b612a1..2e9cf4a884 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:81 + image: ghcr.io/project-chip/chip-build-bouffalolab:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 31988e6638..097a7d103e 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:81 + image: ghcr.io/project-chip/chip-build-ti:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 24edcb3fa9..25afa79903 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:81 + image: ghcr.io/project-chip/chip-build-ti:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index b0b4fef50e..dd9fb120a3 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:85 + image: ghcr.io/project-chip/chip-build-efr32:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index b3a6ed24e6..9853c0df51 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -124,7 +124,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index ada44f1557..49c2097cd6 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:81 + image: ghcr.io/project-chip/chip-build-infineon:90 env: # TODO: this should probably be part of the dockerfile itself CY_TOOLS_PATHS: /opt/Tools/ModusToolbox/tools_3.2 diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 78a1c8dea8..46c2173530 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:81 + image: ghcr.io/project-chip/chip-build-crosscompile:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -65,7 +65,7 @@ jobs: --target linux-arm64-chip-tool-nodeps-ipv6only \ --target linux-arm64-lock-clang \ --target linux-arm64-minmdns-clang \ - --target linux-arm64-light-data-model-enabled-rpc-ipv6only-clang \ + --target linux-arm64-light-rpc-ipv6only-clang \ --target linux-arm64-thermostat-no-ble-clang \ --target linux-arm64-lit-icd-no-ble-clang \ --target linux-arm64-fabric-admin-clang-rpc \ diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index d2f1014eb5..e1d64f7a05 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:81 + image: ghcr.io/project-chip/chip-build-imx:90 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 2bed5acd82..8c483cacd4 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index e2617aeec7..14bfb6fb91 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 steps: - name: Checkout @@ -72,16 +72,13 @@ jobs: "python3 ./scripts/tests/run_tv_casting_test.py" timeout-minutes: 2 # Comment this out to debug if GitHub Action times out. - # TODO: this test is flaky and was disabled - # https://github.com/project-chip/connectedhomeip/issues/34598 - # - # - name: - # Test casting from Linux tv-casting-app to Linux tv-app - - # Commissioner Generated Passcode - # run: | - # ./scripts/run_in_build_env.sh \ - # "python3 ./scripts/tests/run_tv_casting_test.py --commissioner-generated-passcode=True" - # timeout-minutes: 2 # Comment this out to debug if GitHub Action times out. + - name: + Test casting from Linux tv-casting-app to Linux tv-app - + Commissioner Generated Passcode + run: | + ./scripts/run_in_build_env.sh \ + "python3 ./scripts/tests/run_tv_casting_test.py --commissioner-generated-passcode=True" + timeout-minutes: 2 # Comment this out to debug if GitHub Action times out. - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 8f76321a0c..077bdbbfb7 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index d781087fc8..0db5e82e81 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:81 + image: ghcr.io/project-chip/chip-build-nrf-platform:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index f1f682e008..cccfa44557 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:81 + image: ghcr.io/project-chip/chip-build-nuttx:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index c4b6eb148a..aa782544d2 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp:81 + image: ghcr.io/project-chip/chip-build-nxp:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -70,7 +70,7 @@ jobs: run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ - --target nxp-k32w0-freertos-lighting-factory \ + --target nxp-k32w0-freertos-lighting-factory-log-progress \ --target nxp-k32w0-freertos-contact-sensor-low-power-factory \ build \ --copy-artifacts-to out/artifacts \ @@ -79,7 +79,7 @@ jobs: run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w0+release light \ - out/artifacts/nxp-k32w0-freertos-lighting-factory/chip-k32w0x-light-example.elf \ + out/artifacts/nxp-k32w0-freertos-lighting-factory-log-progress/chip-k32w0x-light-example.elf \ /tmp/bloat_reports/ - name: Get K32W0 contact sensor size stats run: | @@ -240,7 +240,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp-zephyr:81 + image: ghcr.io/project-chip/chip-build-nxp-zephyr:90 steps: - name: Checkout diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 95389cb157..2d59643eeb 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: ghcr.io/project-chip/chip-build-openiotsdk:81 + image: ghcr.io/project-chip/chip-build-openiotsdk:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 312c493292..3287b281dc 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 2e8f857673..d10c91a8e8 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index a1d7244ab8..6c8b9bd521 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:81 + image: ghcr.io/project-chip/chip-build-telink:90 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -58,7 +58,7 @@ jobs: gh-context: ${{ toJson(github) }} # - name: Update Zephyr to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 3ed7686a9378de6be1368c912f9a42f998bbfb18" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py f762f1a1027284e63e338e6d83deeade62f355b0" - name: Build example Telink (B92 retention) Air Quality Sensor App # Run test for master and s07641069 PRs @@ -167,14 +167,14 @@ jobs: - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (B92) Light Switch App with OTA, Shell, Factory Data + - name: Build example Telink (B92) Light Switch App with OTA (LZMA), Shell, Factory Data # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-ota-shell-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9528a light-switch-app-ota-shell-factory-data \ - out/telink-tlsr9528a-light-switch-ota-shell-factory-data/zephyr/zephyr.elf \ + telink tlsr9528a light-switch-app-ota-compress-lzma-shell-factory-data \ + out/telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index f0e4dfb3a2..f465f3999f 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:81 + image: ghcr.io/project-chip/chip-build-tizen:90 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 c3871ad881..6acc150c03 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:81 + image: ghcr.io/project-chip/chip-build-android:90 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index c37ca98e1a..f36b370448 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index abf2e75027..f416be3a4d 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:81 + image: ghcr.io/project-chip/chip-build-java:90 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/lint.yml b/.github/workflows/lint.yml index a914e5ae36..590a2595ee 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 steps: - name: Checkout @@ -105,10 +105,8 @@ jobs: --known-failure app/reporting/reporting.cpp \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ --known-failure app/reporting/tests/MockReportScheduler.h \ - --known-failure app/util/attribute-storage.cpp \ --known-failure app/util/attribute-storage-detail.h \ --known-failure app/util/attribute-storage.h \ - --known-failure app/util/attribute-table.cpp \ --known-failure app/util/attribute-table-detail.h \ --known-failure app/util/attribute-table.h \ --known-failure app/util/binding-table.cpp \ @@ -116,11 +114,7 @@ jobs: --known-failure app/util/config.h \ --known-failure app/util/DataModelHandler.cpp \ --known-failure app/util/DataModelHandler.h \ - --known-failure app/util/ember-compatibility-functions.cpp \ - --known-failure app/util/ember-compatibility-functions.h \ - --known-failure app/util/ember-global-attribute-access-interface.cpp \ --known-failure app/util/ember-global-attribute-access-interface.h \ - --known-failure app/util/ember-io-storage.cpp \ --known-failure app/util/ember-io-storage.h \ --known-failure app/util/endpoint-config-api.h \ --known-failure app/util/generic-callbacks.h \ @@ -135,7 +129,12 @@ jobs: --known-failure platform/GLibTypeDeleter.h \ --known-failure platform/SingletonConfigurationManager.cpp \ " - + # These ARE actually orphaned but due to dynamic-server we have code paths + # for them. Keeping them as a list as they still need review ... + # --known-failure app/util/attribute-table.cpp \ + # --known-failure app/util/ember-io-storage.cpp \ + # --known-failure app/util/ember-global-attribute-access-interface.cpp \ + # --known-failure app/util/attribute-storage.cpp \ - name: Check for matter lint errors if: always() run: | @@ -295,11 +294,12 @@ jobs: ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' \ ':(exclude)src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp' \ ':(exclude)src/app/codegen-data-model-provider/tests/EmberReadWriteOverride.cpp' \ + ':(exclude)src/app/dynamic_server/DynamicDispatcher.cpp' \ ':(exclude)src/app/util/attribute-table.cpp' \ ':(exclude)src/app/util/attribute-table.h' \ - ':(exclude)src/app/util/ember-compatibility-functions.cpp' \ ':(exclude)src/app/util/mock/CodegenEmberMocks.cpp' \ ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' \ + ':(exclude)src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm' \ ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' \ && exit 1 || exit 0 diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index dae8a2b8ce..da55158cc7 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:81 + image: ghcr.io/project-chip/chip-build-minimal:90 steps: - name: Checkout @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:81 + image: ghcr.io/project-chip/chip-build-minimal:90 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 783c46ef41..07b31eec0d 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -32,7 +32,7 @@ env: jobs: qemu-esp32: - name: ESP32 + name: ESP32_QEMU env: BUILD_TYPE: esp32-qemu @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:81 + image: ghcr.io/project-chip/chip-build-esp32-qemu:90 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -79,7 +79,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:81 + image: ghcr.io/project-chip/chip-build-tizen-qemu:90 options: --user root volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 54997b6efa..14b2c32745 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:90 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:85 + image: ghcr.io/project-chip/chip-build-efr32:90 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 7d0e124ca5..38a614e712 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:81 + image: ghcr.io/project-chip/chip-build-android:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 63957b64d8..9a31e56ca8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -457,7 +457,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -487,14 +487,14 @@ jobs: scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv' ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die \ + --target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-network-manager-ipv6only-no-ble-no-wifi-tsan-clang-test \ - --target linux-x64-fabric-admin-rpc-ipv6only-clang \ + --target linux-x64-fabric-admin-rpc-ipv6only-no-ble-no-wifi-clang \ --target linux-x64-fabric-bridge-rpc-ipv6only-no-ble-no-wifi-clang \ --target linux-x64-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang \ --target linux-x64-python-bindings \ @@ -504,14 +504,14 @@ jobs: - name: Generate an argument environment file run: | echo -n "" >/tmp/test_env.yaml - echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die/chip-all-clusters-app" >> /tmp/test_env.yaml + echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml echo "CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app" >> /tmp/test_env.yaml echo "ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml echo "LIT_ICD_APP: out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml echo "CHIP_MICROWAVE_OVEN_APP: out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app" >> /tmp/test_env.yaml echo "CHIP_RVC_APP: out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app" >> /tmp/test_env.yaml echo "NETWORK_MANAGEMENT_APP: out/linux-x64-network-manager-ipv6only-no-ble-no-wifi-tsan-clang-test/matter-network-manager-app" >> /tmp/test_env.yaml - echo "FABRIC_ADMIN_APP: out/linux-x64-fabric-admin-rpc-ipv6only-clang/fabric-admin" >> /tmp/test_env.yaml + echo "FABRIC_ADMIN_APP: out/linux-x64-fabric-admin-rpc-ipv6only-no-ble-no-wifi-clang/fabric-admin" >> /tmp/test_env.yaml echo "FABRIC_BRIDGE_APP: out/linux-x64-fabric-bridge-rpc-ipv6only-no-ble-no-wifi-clang/fabric-bridge-app" >> /tmp/test_env.yaml echo "LIGHTING_APP_NO_UNIQUE_ID: out/linux-x64-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang/chip-lighting-app" >> /tmp/test_env.yaml echo "TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml @@ -523,7 +523,7 @@ jobs: mkdir -p out/trace_data scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/controller/python/test/test_scripts/mobile-device-test.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/execute_python_tests.py --env-file /tmp/test_env.yaml --search-directory src/python_testing' - scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py --all-clusters out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die/chip-all-clusters-app' + scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py --all-clusters out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestSpecParsingDeviceType.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceSupport.py' diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index b51dfaa8fc..b2fc345bda 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -74,7 +74,7 @@ jobs: *) ;; esac - scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" + scripts/build/gn_gen.sh --args="$GN_ARGS" - name: Run Build run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE" - name: Run Tests diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 483b9486d1..0d6d9b6db7 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 717f8ca956..c4edd57421 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:90 defaults: run: shell: sh @@ -62,7 +62,7 @@ jobs: - name: Generate all run: ./scripts/run_in_build_env.sh scripts/tools/zap_regen_all.py - name: Generate script-maintained items (ERROR_CODES.md) - run: ./scripts/run_in_build_env.sh "scripts/error_table.py > docs/ERROR_CODES.md" + run: ./scripts/run_in_build_env.sh "scripts/error_table.py > docs/ids_and_codes/ERROR_CODES.md" - name: Ensure git works in current working directory run: git config --global --add safe.directory `pwd` - name: Check for uncommited changes diff --git a/.gitmodules b/.gitmodules index 824bd9954e..4eca51b5cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -332,6 +332,7 @@ [submodule "third_party/lwip/repo"] path = third_party/lwip/repo url = https://github.com/lwip-tcpip/lwip.git + excluded-platforms = darwin [submodule "third_party/abseil-cpp/src"] path = third_party/abseil-cpp/src url = https://github.com/abseil/abseil-cpp.git diff --git a/.gn b/.gn index 07b5accb51..ebd301ee7c 100644 --- a/.gn +++ b/.gn @@ -13,7 +13,6 @@ # limitations under the License. import("//build_overrides/build.gni") -import("//build_overrides/googletest.gni") import("//build_overrides/pigweed.gni") # The location of the build configuration file. @@ -34,15 +33,10 @@ default_args = { # GN target to use for the default Python build venv. pw_build_PYTHON_BUILD_VENV = "//:matter_build_venv" - # Use the GoogleTest backend for unit tests running on host. - pw_unit_test_BACKEND = "$dir_pw_unit_test:googletest" - pw_unit_test_MAIN = "$dir_pigweed/third_party/googletest:gmock_main" - dir_pw_third_party_googletest = "$dir_googletest" - # Required for pw_unit_test pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" - pw_assert_BACKEND = "$dir_pw_assert_log" - pw_log_BACKEND = "$dir_pw_log_basic" + pw_assert_BACKEND = "//src/pw_backends/assert" + pw_log_BACKEND = "//src/pw_backends/log" # TODO: Make sure only unit tests link against this pw_build_LINK_DEPS = [ diff --git a/.restyled.yaml b/.restyled.yaml index c201729d30..446dad740b 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -83,9 +83,7 @@ exclude: - "scripts/setup/bootstrap.sh" # tries to quote loop variable - "integrations/docker/build-all.sh" # tries to quote loop variable - "scripts/setup/pigweed.json" # TODO(#29547). This file is temporary copy from pigweed repo that has minor edits. No restyle help in diff. - - "docs/ERROR_CODES.md" # generated by scripts, not easy to align tables - - "docs/zap_clusters.md" # generated by scripts, not easy to align tables - - "docs/spec_clusters.md" # generated by scripts, not easy to align tables + - "docs/ids_and_codes/**" # generated by scripts, not easy to align tables - "docs/testing/yaml_pseudocluster.md" # generated by scripts, restyler makes the tables render improperly - "docs/testing/yaml_schema.md" # generated by scripts, restyler makes the tables render improperly diff --git a/.spellcheck.yml b/.spellcheck.yml index 757034586b..36461334c8 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -65,7 +65,7 @@ matrix: # converts markdown to HTML - pyspelling.filters.markdown: sources: - - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md|!docs/testing/python.md|!docs/testing/ChipDeviceCtrlAPI.md|!docs/issue_triage.md' + - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ids_and_codes/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md|!docs/testing/python.md|!docs/testing/ChipDeviceCtrlAPI.md|!docs/issue_triage.md' aspell: ignore-case: true camel-case: true diff --git a/.vscode/launch.json b/.vscode/launch.json index fc821c76eb..97ba95d77f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -34,6 +34,25 @@ "args": [], "cwd": "${workspaceFolder}" }, + + { + "name": "Run pw FuzzTest (Linux x64) UnitTest Mode", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/out/${input:outPWFuzzTestLinux}", + "cwd": "${workspaceFolder}" + }, + + { + "name": "Run pw FuzzTest (Linux x64) Continuous Fuzzing Mode", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/out/${input:outPWFuzzTestLinux}", + "args": ["-fuzz=${input:fuzzTestName}"], + "cwd": "${workspaceFolder}", + "preLaunchTask": "" + }, + { "name": "QRCode Tests", "type": "cppdbg", @@ -528,6 +547,24 @@ "description": "Select the test to run" } }, + { + "type": "command", + "id": "outPWFuzzTestLinux", + "command": "shellCommand.execute", + "args": { + "command": "find ${workspaceFolder}/out/linux-x64-*/chip_pw_fuzztest/tests -type f -executable |sort |sed 's$${workspaceFolder}/out/$$'", + "description": "Select the FuzzTest to run" + } + }, + { + "id": "fuzzTestName", + "type": "command", + "command": "shellCommand.execute", + "args": { + "command": "./out/${input:outPWFuzzTestLinux} --list_fuzz_tests | grep 'Fuzz test:' | awk -F ': ' '{print $2}'", + "description": "Select the specific FuzzTest to fuzz continuously" + } + }, { "type": "pickString", "id": "mbedDebugProfile", diff --git a/BUILD.gn b/BUILD.gn index e05f14312d..a777fa84b3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -70,6 +70,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { "${chip_root}/src/lib/core/tests:fuzz-tlv-reader-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", "${chip_root}/src/lib/dnssd/minimal_mdns/tests:fuzz-minmdns-packet-parsing-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", "${chip_root}/src/lib/format/tests:fuzz-payload-decoder-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", + "${chip_root}/src/protocols/secure_channel/tests:fuzz-PASE-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", "${chip_root}/src/setup_payload/tests:fuzz-setup-payload-base38-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", ] } diff --git a/build/chip/chip_test_suite.gni b/build/chip/chip_test_suite.gni index de6b7c1684..19264b9051 100644 --- a/build/chip/chip_test_suite.gni +++ b/build/chip/chip_test_suite.gni @@ -14,6 +14,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("//build_overrides/googletest.gni") import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/tests.gni") @@ -120,6 +121,10 @@ template("chip_test_suite") { # Link to the common lib for this suite so we get its `sources`. public_deps += [ ":${_suite_name}.lib" ] + if (pw_unit_test_BACKEND == "$dir_pw_unit_test:googletest") { + test_main = "$dir_pigweed/third_party/googletest:gmock_main" + } + # Set variables that the platform executable may need. if (test_executable_output_name != "") { output_name = test_executable_output_name + _test_name + diff --git a/build/chip/esp32/esp32_codegen.cmake b/build/chip/esp32/esp32_codegen.cmake index 7febb08987..9cbd839f10 100644 --- a/build/chip/esp32/esp32_codegen.cmake +++ b/build/chip/esp32/esp32_codegen.cmake @@ -71,15 +71,7 @@ macro(chip_app_component_zapgen ZAP_NAME) add_dependencies(${COMPONENT_LIB} app-zapgen) target_include_directories(${COMPONENT_LIB} PUBLIC "${APP_TEMPLATE_GEN_DIR}") - target_sources(${COMPONENT_LIB} PRIVATE ${APP_TEMPLATE_GEN_FILES}) - - # When data model interface is used, provide a default code-generation data model as - # part of zapgen. See `chip_data_model.cmake` for similar logic - set(CHIP_DATA_MODEL_INTERFACE "disabled" CACHE STRING "Data model interface option to use: enabled or disabled") - - if ("${CHIP_DATA_MODEL_INTERFACE}" STREQUAL "enabled") - target_sources(${COMPONENT_LIB} PRIVATE ${CODEGEN_DATA_MODEL_SOURCES}) - endif() + target_sources(${COMPONENT_LIB} PRIVATE ${APP_TEMPLATE_GEN_FILES} ${CODEGEN_DATA_MODEL_SOURCES}) endif() endmacro() diff --git a/build/chip/tests.gni b/build/chip/tests.gni index 0c2c742d64..57d0311694 100755 --- a/build/chip/tests.gni +++ b/build/chip/tests.gni @@ -26,6 +26,10 @@ declare_args() { declare_args() { # Enable building tests. chip_build_tests = current_os != "freertos" + + # Enabling useful support functions when building using GoogleTest framework (used in unit tests and pw_fuzzer FuzzTests) + # For unit tests: this should only be enabled through build_examples.py, see PR #36268 + chip_build_tests_googletest = false } declare_args() { diff --git a/build/toolchain/pw_fuzzer/BUILD.gn b/build/toolchain/pw_fuzzer/BUILD.gn index 468a615448..b5a751bc98 100644 --- a/build/toolchain/pw_fuzzer/BUILD.gn +++ b/build/toolchain/pw_fuzzer/BUILD.gn @@ -64,6 +64,9 @@ gcc_toolchain("chip_pw_fuzztest") { dir_pw_third_party_fuzztest = "//third_party/fuzztest" dir_pw_third_party_googletest = "$dir_googletest" + # Since pw_fuzzer uses GoogleTest, activating this allows us to benefit from supporting functions + chip_build_tests_googletest = true + # TODO: Seems that re2 support within FuzzTest was deprecated, keeping it defined is triggering warning # Remove if re2 is indeed not needed # dir_pw_third_party_re2 = "//third_party/re2/src" diff --git a/build_overrides/efr32_sdk.gni b/build_overrides/efr32_sdk.gni index 4a7344b4c7..fd5e7ce094 100644 --- a/build_overrides/efr32_sdk.gni +++ b/build_overrides/efr32_sdk.gni @@ -14,5 +14,5 @@ declare_args() { # Root directory for efr32 SDK build files. - efr32_sdk_build_root = "//third_party/silabs" + silabs_sdk_build_root = "//third_party/silabs" } diff --git a/config/android/CHIPProjectConfig.h b/config/android/CHIPProjectConfig.h index 5b55f3ba74..fd8c7abaa8 100644 --- a/config/android/CHIPProjectConfig.h +++ b/config/android/CHIPProjectConfig.h @@ -26,18 +26,11 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -// Enable UDP listening on demand in the CHIPDeviceController -#define CHIP_CONFIG_DEVICE_CONTROLLER_DEMAND_ENABLE_UDP 1 - #define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0 // Uncomment this for a large Tunnel MTU. -//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) +// #define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 300 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - -#define CHIP_CONFIG_MAX_SOFTWARE_VERSION_LENGTH 128 - #endif /* CHIPPROJECTCONFIG_H */ diff --git a/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni b/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni index 2cfbc034e8..86c20ccc72 100644 --- a/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni +++ b/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "${chip_root}/examples/platform/bouffalolab/common/rpc/pw_sys_io:pw_sys_io" diff --git a/config/common/cmake/chip_gn_args.cmake b/config/common/cmake/chip_gn_args.cmake index 8fde49c343..7d86d1fb43 100644 --- a/config/common/cmake/chip_gn_args.cmake +++ b/config/common/cmake/chip_gn_args.cmake @@ -171,7 +171,6 @@ macro(matter_common_gn_args) LIB_PW_RPC DEVICE_INFO_EXAMPLE_PROVIDER PROJECT_CONFIG - DATA_MODEL_INTERFACE ) set(multiValueArgs PROJECT_CONFIG_INC_DIR @@ -204,10 +203,6 @@ macro(matter_common_gn_args) matter_add_gn_arg_bool ("chip_build_example_providers" ${ARG_DEVICE_INFO_EXAMPLE_PROVIDER}) endif() # ARG_DEVICE_INFO_EXAMPLE_PROVIDER - if (ARG_DATA_MODEL_INTERFACE) - matter_add_gn_arg_string("chip_use_data_model_interface" "${ARG_DATA_MODEL_INTERFACE}") - endif() - if (ARG_PROJECT_CONFIG) get_filename_component(PROJECT_CONFIG ${ARG_PROJECT_CONFIG} diff --git a/config/efr32/lib/pw_rpc/pw_rpc.gni b/config/efr32/lib/pw_rpc/pw_rpc.gni index 101112c12d..ac5e3831da 100644 --- a/config/efr32/lib/pw_rpc/pw_rpc.gni +++ b/config/efr32/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" pw_sys_io_BACKEND = "${chip_root}/examples/platform/silabs/pw_sys_io:pw_sys_io_silabs" diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index fde62765dd..f3e919d3b6 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -33,8 +33,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/ota-image.cmake) set(CHIP_REQUIRE_COMPONENTS esp_eth freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash spi_flash) -set(CHIP_DATA_MODEL_INTERFACE "disabled" CACHE STRING "Data model interface option to use: enabled or disabled") - if(NOT "${IDF_TARGET}" STREQUAL "esp32h2") list(APPEND CHIP_REQUIRE_COMPONENTS mdns) endif() @@ -66,12 +64,6 @@ macro(chip_gn_arg_bool arg boolean) endif() endmacro() -if ("${CHIP_DATA_MODEL_INTERFACE}" STREQUAL "enabled") - chip_gn_arg_append("chip_use_data_model_interface" "\"enabled\"") -else() - chip_gn_arg_append("chip_use_data_model_interface" "\"disabled\"") -endif() - # ESP-IDF lets user set software version string by two ways: # 1. Project's CMakeLists.txt file and 2. Config option # It depends on CONFIG_APP_PROJECT_VER_FROM_CONFIG option @@ -436,6 +428,8 @@ if(CONFIG_BT_ENABLED) idf_component_get_property(bt_dir bt COMPONENT_DIR) list(APPEND chip_libraries $) list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a") + elseif(target_name STREQUAL "esp32p4") + list(APPEND chip_libraries $) else() list(APPEND chip_libraries $ -lbtdm_app) endif() @@ -515,10 +509,10 @@ idf_component_get_property(lwip_lib lwip COMPONENT_LIB) list(APPEND chip_libraries $) +idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB) +list(APPEND chip_libraries $) if (CONFIG_ESP32_WIFI_ENABLED) - idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB) idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR) - list(APPEND chip_libraries $) if (CONFIG_IDF_TARGET_ESP32C2) set(blobs core net80211 pp) else() @@ -544,6 +538,7 @@ list(APPEND chip_libraries $) idf_component_get_property(esp_hw_support_lib esp_hw_support COMPONENT_LIB) list(APPEND chip_libraries $) +if (NOT CONFIG_IDF_TARGET_ESP32P4) idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB) idf_component_get_property(esp_phy_dir esp_phy COMPONENT_DIR) list(APPEND chip_libraries $) @@ -558,8 +553,12 @@ endif() foreach(phy_blob ${phy_blobs}) list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a") endforeach() +endif() -set(components_to_link esp_event hal esp_system soc efuse vfs driver esp_coex freertos esp_timer) +set(components_to_link esp_event hal esp_system soc efuse vfs driver freertos esp_timer) +if (NOT CONFIG_IDF_TARGET_ESP32P4) +list(APPEND components_to_link esp_coex) +endif() idf_build_get_property(build_components BUILD_COMPONENTS) foreach(component ${components_to_link}) # Some of the components are not present in IDF v4.x diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index c61ac770a6..83d3f1c893 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -37,16 +37,6 @@ menu "CHIP Core" exchange (conversation) with a peer, e.g. a cloud service, a mobile application, or another device. - config MAX_BINDINGS - int "Max Bindings" - range 0 65535 - default 8 - help - The maximum number of simultaneously active CHIP Binding objects. - - A Binding object is used to configure how the local device communicates with - a remote entity, be it a cloud service, a mobile application, or another device. - config MAX_FABRICS int "Max Fabrics" range 5 255 diff --git a/config/esp32/components/chip/idf_component.yml b/config/esp32/components/chip/idf_component.yml index 2e7415827f..78d21af787 100644 --- a/config/esp32/components/chip/idf_component.yml +++ b/config/esp32/components/chip/idf_component.yml @@ -18,7 +18,7 @@ dependencies: - if: "idf_version >=4.4" espressif/esp_insights: - version: "1.0.1" + version: "1.2.2" require: public # There is an issue with IDF-Component-Manager when ESP Insights is included. # Issue: https://github.com/project-chip/connectedhomeip/issues/29125 @@ -26,14 +26,6 @@ dependencies: - if: "idf_version >=5.0" - if: "target != esp32h2" - # This matches the dependency of esp_insights - espressif/esp_diag_data_store: - version: "1.0.1" - require: public - rules: - - if: "idf_version >=5.0" - - if: "target != esp32h2" - espressif/esp_rcp_update: version: "1.2.0" rules: @@ -44,3 +36,8 @@ dependencies: require: public rules: - if: "idf_version >=4.3" + + espressif/esp_wifi_remote: + version: ">=0.1.12" + rules: + - if: "target in [esp32p4]" diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index 37dad13532..88567b604e 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -112,9 +112,6 @@ if (CONFIG_MBED_BSD_SOCKET_TRACE) matter_add_flags(-DMBED_BSD_SOCKET_TRACE=1) endif() -# Option can be set with `-DCHIP_DATA_MODEL_INTERFACE=enabled` or similar on the command line -set(CHIP_DATA_MODEL_INTERFACE "disabled" CACHE STRING "Data model interface option to use: enabled or disabled") - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -124,7 +121,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS LIB_PW_RPC CONFIG_CHIP_PW_RPC PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} - DATA_MODEL_INTERFACE ${CHIP_DATA_MODEL_INTERFACE} ) if (CONFIG_CHIP_PW_RPC) matter_add_gn_arg_import("${GN_ROOT_TARGET}/lib/pw_rpc/pw_rpc.gni") diff --git a/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni b/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni index 2b03f6b4c9..50ef9977fa 100644 --- a/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni +++ b/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "${chip_root}/examples/platform/mbed/pw_sys_io:pw_sys_io_mbed" pw_rpc_system_server_BACKEND = diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index b3180fdc1b..448287f0ec 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -106,13 +106,6 @@ endif() get_property(CHIP_COMPILER_LAUNCHER GLOBAL PROPERTY RULE_LAUNCH_COMPILE) - -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -123,7 +116,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) diff --git a/config/nxp/chip-cmake-freertos/CMakeLists.txt b/config/nxp/chip-cmake-freertos/CMakeLists.txt index 27bedc50ae..a3c59dcb1f 100644 --- a/config/nxp/chip-cmake-freertos/CMakeLists.txt +++ b/config/nxp/chip-cmake-freertos/CMakeLists.txt @@ -44,18 +44,12 @@ endif() # ============================================================================== matter_add_gn_arg_string("nxp_nvm_component" ${CONFIG_CHIP_NVM_COMPONENT}) matter_add_gn_arg_string("nxp_platform" ${CONFIG_CHIP_NXP_PLATFORM}) -matter_add_gn_arg("chip_with_factory_data" ${CONFIG_CHIP_FACTORY_DATA}) -matter_add_gn_arg("chip_enable_secure_dac_private_key_storage" ${CONFIG_CHIP_SECURE_DAC_PRIVATE_KEY_STORAGE}) -matter_add_gn_arg("chip_enable_secure_whole_factory_data" ${CONFIG_CHIP_ENABLE_SECURE_WHOLE_FACTORY_DATA}) -matter_add_gn_arg_bool("chip_enable_matter_cli" CONFIG_CHIP_LIB_SHELL) +matter_add_gn_arg_bool("nxp_use_factory_data" ${CONFIG_CHIP_FACTORY_DATA}) +matter_add_gn_arg_bool("nxp_enable_secure_dac_private_key_storage" ${CONFIG_CHIP_SECURE_DAC_PRIVATE_KEY_STORAGE}) +matter_add_gn_arg_bool("nxp_enable_secure_whole_factory_data" ${CONFIG_CHIP_ENABLE_SECURE_WHOLE_FACTORY_DATA}) +matter_add_gn_arg_bool("nxp_enable_matter_cli" CONFIG_CHIP_LIB_SHELL) matter_add_gn_arg_bool("chip_enable_pairing_autostart" CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART) -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - if(CONFIG_BOOTLOADER_MCUBOOT) matter_add_gn_arg_bool("no_mcuboot" false) endif(CONFIG_BOOTLOADER_MCUBOOT) @@ -73,7 +67,6 @@ else() PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} PROJECT_CONFIG_INC_DIR ${CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) endif() diff --git a/config/nxp/chip-module/CMakeLists.txt b/config/nxp/chip-module/CMakeLists.txt index 5024672e14..66894861d4 100644 --- a/config/nxp/chip-module/CMakeLists.txt +++ b/config/nxp/chip-module/CMakeLists.txt @@ -91,13 +91,6 @@ endif() get_property(CHIP_COMPILER_LAUNCHER GLOBAL PROPERTY RULE_LAUNCH_COMPILE) -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -108,7 +101,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) diff --git a/config/nxp/lib/pw_rpc/pw_rpc.gni b/config/nxp/lib/pw_rpc/pw_rpc.gni index 68255db8bb..f91c53cf35 100644 --- a/config/nxp/lib/pw_rpc/pw_rpc.gni +++ b/config/nxp/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" pw_sys_io_BACKEND = "${chip_root}/examples/platform/nxp/pw_sys_io:pw_sys_io_nxp" diff --git a/config/python/CHIPProjectConfig.h b/config/python/CHIPProjectConfig.h index 4412c5bec7..d8960f647d 100644 --- a/config/python/CHIPProjectConfig.h +++ b/config/python/CHIPProjectConfig.h @@ -59,8 +59,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - /* TODO: Ideally, these #defines should be enabled by default for Linux AND the python tool would provide runtime options to enable/disable them */ #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 1 diff --git a/config/qpg/chip-gn/build.sh b/config/qpg/chip-gn/build.sh index 541da26252..974caaaf0a 100755 --- a/config/qpg/chip-gn/build.sh +++ b/config/qpg/chip-gn/build.sh @@ -31,7 +31,7 @@ gn \ --root-target=//config/qpg/chip-gn \ --dotfile="$GN_ROOT_TARGET/.gn" \ --script-executable=python3 \ - --export-compile-commands \ + --add-export-compile-commands="*" \ gen \ --check \ --args="$GN_ARGS" \ diff --git a/config/qpg/lib/pw_rpc/pw_rpc.gni b/config/qpg/lib/pw_rpc/pw_rpc.gni index 60fb93e6b8..8e282c3bf0 100644 --- a/config/qpg/lib/pw_rpc/pw_rpc.gni +++ b/config/qpg/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "${chip_root}/examples/platform/qpg/pw_sys_io:pw_sys_io_qpg" pw_build_LINK_DEPS = [ diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index 27abcbb247..3e91ea40c1 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -60,8 +60,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #ifndef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4 #endif diff --git a/config/telink/app/bootloader_compress_lzma.conf b/config/telink/app/bootloader_compress_lzma.conf new file mode 100644 index 0000000000..cb349eed0c --- /dev/null +++ b/config/telink/app/bootloader_compress_lzma.conf @@ -0,0 +1,46 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Enable overwrite the primary slot with the upgrade image instead of swapping them. +# This prevents the fallback recovery. +CONFIG_BOOT_UPGRADE_ONLY=y + +# Enable this option in case if the whole slot0 image need to be validated +# With disabled option the only image magic is validated +CONFIG_BOOT_VALIDATE_SLOT0=y + +# Maximum number of image sectors supported by the bootloader. +# Maximum signed image size: 512 * 4096 = 2M Bytes +CONFIG_BOOT_MAX_IMG_SECTORS=512 + +# Sets log level for modules which don't specify it explicitly. +# When set to 0 it means log will not be activated for those modules. +# Levels are: +# - 0 OFF, do not write by default +# - 1 ERROR, default to only write LOG_LEVEL_ERR +# - 2 WARNING, default to write LOG_LEVEL_WRN +# - 3 INFO, default to write LOG_LEVEL_INFO +# - 4 DEBUG, default to write LOG_LEVEL_DBG +CONFIG_LOG_DEFAULT_LEVEL=3 + +# LZMA used sys_heap based allocators +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=78000 + +# Enable build size optimizations +CONFIG_SIZE_OPTIMIZATIONS=y + +# Enable support LZMA compression +CONFIG_COMPRESS_LZMA=y diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index bfc26ce5d9..ade2bd310f 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -77,12 +77,6 @@ if (CONFIG_CHIP_OPENTHREAD_CONFIG) zephyr_set_openthread_config(${CHIP_OPENTHREAD_CONFIG}) endif() -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -93,7 +87,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) @@ -162,6 +155,10 @@ set_property(GLOBAL APPEND PROPERTY ZEPHYR_INTERFACE_LIBS chip) include(${TELINK_COMMON}/common.cmake) +if (CONFIG_CHIP_APP_LOG_LEVEL GREATER_EQUAL 4) + include(${TELINK_COMMON}/build_info.cmake) +endif() + # ============================================================================== # Define 'process_binaries' target for collecting final binary to flash # ============================================================================== @@ -192,8 +189,17 @@ endif() # ============================================================================== if (CONFIG_CHIP_OTA_IMAGE_BUILD) + if (CONFIG_COMPRESS_LZMA) + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/${CONFIG_SIGNED_OTA_IMAGE_FILE_NAME} + COMMAND ${CMAKE_COMMAND} -E true + COMMENT "Fake command, ${CONFIG_SIGNED_OTA_IMAGE_FILE_NAME} file created in process_binaries target" + DEPENDS ${ZEPHYR_FINAL_EXECUTABLE} + ) + endif() + chip_ota_image(chip-ota-image - INPUT_FILES ${PROJECT_BINARY_DIR}/zephyr.signed.bin + INPUT_FILES ${PROJECT_BINARY_DIR}/${CONFIG_SIGNED_OTA_IMAGE_FILE_NAME} OUTPUT_FILE ${PROJECT_BINARY_DIR}/${CONFIG_CHIP_OTA_IMAGE_FILE_NAME} ) add_dependencies(chip-ota-image process_binaries) diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index 7d9296bed5..ee87af2bbe 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -71,6 +71,27 @@ config CHIP_OTA_IMAGE_BUILD bool default y if CHIP_OTA_REQUESTOR +config SIGNED_OTA_IMAGE_FILE_NAME + string "Zephyr signed image file name" + default "zephyr.signed.lzma.signed.bin" if COMPRESS_LZMA + default "zephyr.signed.bin" + depends on CHIP_OTA_REQUESTOR + help + Provides the file name of the generated Zephyr signed image. + +config TELINK_OTA_BUTTON_TEST + bool "Enable image update initiation via button press" + default n + depends on CHIP_OTA_REQUESTOR + help + Merge the signed binary with the same version as the main into slot-1 of merged.hex. + Pressing the button initiates a forced image update. + +config TELINK_OTA_PARTITION_ADDR + hex "image-1 partition address" + default $(dt_node_reg_addr_hex,$(dt_nodelabel_path,slot1_partition),0) + depends on TELINK_OTA_BUTTON_TEST + config CHIP_ROTATING_DEVICE_ID bool "Generate rotating device ID" default y diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index 835b14c181..d28d77d6cf 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -83,7 +83,12 @@ config COMMON_LIBC_MALLOC_ARENA_SIZE default 12288 config NET_IPV6_MLD - default n + default n if PM + default y + +config NET_IF_MCAST_IPV6_ADDR_COUNT + default 8 if PM + default 15 # Network buffers config NET_PKT_RX_COUNT @@ -272,6 +277,10 @@ config OPENTHREAD_DEFAULT_TX_POWER default 3 if PM default 9 +config OPENTHREAD_IP6_MAX_EXT_MCAST_ADDRS + default 2 if PM + default 8 + endif # NET_L2_OPENTHREAD config NET_TX_STACK_SIZE diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 27598c7095..d8717a625d 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -581,11 +581,4 @@ config CHIP_BLE_ADVERTISING_DURATION If CHIP_BLE_EXT_ADVERTISING is set to false, the maximum duration time is 15 minutes, else the maximum duration time can be extended to 2880 minutes (48h). -config USE_CHIP_DATA_MODEL_INTERFACE - bool "Use a DataModel::Provider interface for data access" - help - This enables a level of indiraction in the CHIP interaction model engine in - accessing underlying data and executing operations such as - wildcard-expansion, read, write and invoke. - endif diff --git a/config/zephyr/chip-module/CMakeLists.txt b/config/zephyr/chip-module/CMakeLists.txt index fb94465b77..3461a97467 100644 --- a/config/zephyr/chip-module/CMakeLists.txt +++ b/config/zephyr/chip-module/CMakeLists.txt @@ -70,12 +70,6 @@ if(CONFIG_CHIP) zephyr_set_openthread_config(${CHIP_OPENTHREAD_CONFIG}) endif() - if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") - else() - set(DATA_MODEL_INTERFACE "disabled") - endif() - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -84,7 +78,6 @@ if(CONFIG_CHIP) LIB_SHELL CONFIG_CHIP_LIB_SHELL LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) diff --git a/credentials/generate-revocation-set.py b/credentials/generate-revocation-set.py index e0d0cb611f..4cdcfdbad1 100644 --- a/credentials/generate-revocation-set.py +++ b/credentials/generate-revocation-set.py @@ -26,6 +26,7 @@ import subprocess import sys from enum import Enum +from typing import Optional import click import requests @@ -91,6 +92,112 @@ def parse_vid_pid_from_distinguished_name(distinguished_name): return vid, pid +def get_akid(cert: x509.Certificate) -> Optional[bytes]: + try: + return cert.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier + except Exception: + logging.warning("AKID not found in certificate") + return None + + +def get_skid(cert: x509.Certificate) -> Optional[bytes]: + try: + return cert.extensions.get_extension_for_oid(x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier + except Exception: + logging.warning("SKID not found in certificate") + return None + + +def get_subject_b64(cert: x509.Certificate) -> str: + return base64.b64encode(cert.subject.public_bytes()).decode('utf-8') + + +def get_issuer_b64(cert: x509.Certificate) -> str: + return base64.b64encode(cert.issuer.public_bytes()).decode('utf-8') + + +def verify_cert(cert: x509.Certificate, root: x509.Certificate) -> bool: + ''' + Verifies if the cert is signed by root. + ''' + + cert_akid = get_akid(cert) + root_skid = get_skid(root) + if cert_akid is None or root_skid is None or cert_akid != root_skid: + return False + + if cert.issuer != root.subject: + return False + + # public_key().verify() do not return anything if signature is valid, + # will raise an exception if signature is invalid + try: + root.public_key().verify(cert.signature, cert.tbs_certificate_bytes, ec.ECDSA(cert.signature_hash_algorithm)) + except Exception: + logging.warning(f"Signature verification failed for cert subject: {get_subject_b64(cert)}, issuer: {get_issuer_b64(cert)}") + return False + + return True + + +def is_self_signed_certificate(cert: x509.Certificate) -> bool: + return verify_cert(cert, cert) + + +# delegator is optional so can be None, but crl_signer and paa has to be present +def validate_cert_chain(crl_signer: x509.Certificate, crl_signer_delegator: x509.Certificate, paa: x509.Certificate): + ''' + There could be four scenarios: + 1. CRL Signer is PAA itself, hence its self-signed certificate + 2. CRL Signer is PAI certificate, and we can validate (crl_signer -> paa) chain + 3. CRL Signer delegator is PAA, and we can validate (crl_signer -> crl_signer_delegator(paa) -> paa) chain + 4. CRL Signer delegator is PAI, and we can validate (crl_signer -> crl_signer_delegator -> paa) chain + ''' + + if crl_signer_delegator: + return verify_cert(crl_signer, crl_signer_delegator) and verify_cert(crl_signer_delegator, paa) + else: + return verify_cert(crl_signer, paa) + + +def validate_vid_pid(revocation_point: dict, crl_signer_certificate: x509.Certificate, crl_signer_delegator_certificate: x509.Certificate) -> bool: + crl_signer_vid, crl_signer_pid = parse_vid_pid_from_distinguished_name(crl_signer_certificate.subject) + + if revocation_point["isPAA"]: + if crl_signer_vid is not None: + if revocation_point["vid"] != crl_signer_vid: + logging.warning("VID in CRL Signer Certificate does not match with VID in revocation point, continue...") + return False + else: + vid_to_match = crl_signer_vid + pid_to_match = crl_signer_pid + + # if the CRL Signer is delegated then match the VID and PID of the CRL Signer Delegator + if crl_signer_delegator_certificate: + vid_to_match, pid_to_match = parse_vid_pid_from_distinguished_name(crl_signer_delegator_certificate.subject) + + if vid_to_match is None or revocation_point["vid"] != vid_to_match: + logging.warning("VID in CRL Signer Certificate does not match with VID in revocation point, continue...") + return False + + if pid_to_match is not None: + if revocation_point["pid"] != pid_to_match: + logging.warning("PID in CRL Signer Certificate does not match with PID in revocation point, continue...") + return False + + return True + + +def fetch_crl_from_url(url: str, timeout: int) -> x509.CertificateRevocationList: + logging.debug(f"Fetching CRL from {url}") + + try: + r = requests.get(url, timeout=timeout) + return x509.load_der_x509_crl(r.content) + except Exception: + logging.error('Failed to fetch a valid CRL') + + class DCLDClient: ''' A client for interacting with DCLD using either the REST API or command line interface (CLI). @@ -172,30 +279,50 @@ def get_revocation_points(self) -> list[dict]: return response["PkiRevocationDistributionPoint"] - def get_paa_cert_for_crl_issuer(self, crl_signer_issuer_name_b64, crl_signer_authority_key_id) -> str: + def get_issuer_cert(self, cert: x509.Certificate) -> Optional[x509.Certificate]: ''' - Get PAA certificate for CRL issuer + Get the issuer certificate for Parameters ---------- - crl_signer_issuer_name_b64: str - The issuer name of the CRL signer. - crl_signer_authority_key_id: str - The authority key ID of the CRL signer. + cert: x509.Certificate + Certificate Returns ------- str - PAA certificate in PEM format + Issuer certificate in PEM format ''' + issuer_name_b64 = get_issuer_b64(cert) + akid = get_akid(cert) + if akid is None: + return + + # Convert CRL Signer AKID to colon separated hex + akid_hex = akid.hex().upper() + akid_hex = ':'.join([akid_hex[i:i+2] for i in range(0, len(akid_hex), 2)]) + + logging.debug( + f"Fetching issuer from:{self.rest_node_url}/dcl/pki/certificates/{issuer_name_b64}/{akid_hex}") + if self.use_rest: response = requests.get( - f"{self.rest_node_url}/dcl/pki/certificates/{crl_signer_issuer_name_b64}/{crl_signer_authority_key_id}").json() + f"{self.rest_node_url}/dcl/pki/certificates/{issuer_name_b64}/{akid_hex}").json() else: response = self.get_dcld_cmd_output_json( - ['query', 'pki', 'x509-cert', '-u', crl_signer_issuer_name_b64, '-k', crl_signer_authority_key_id]) + ['query', 'pki', 'x509-cert', '-u', issuer_name_b64, '-k', akid_hex]) + + issuer_certificate = response["approvedCertificates"]["certs"][0]["pemCert"] + + logging.debug(f"issuer: {issuer_certificate}") - return response["approvedCertificates"]["certs"][0]["pemCert"] + try: + issuer_certificate_object = x509.load_pem_x509_certificate(bytes(issuer_certificate, 'utf-8')) + except Exception: + logging.error('Failed to parse PAA certificate') + return + + return issuer_certificate_object def get_revocations_points_by_skid(self, issuer_subject_key_id) -> list[dict]: ''' @@ -211,6 +338,7 @@ def get_revocations_points_by_skid(self, issuer_subject_key_id) -> list[dict]: list[dict] List of revocation points ''' + if self.use_rest: response = requests.get(f"{self.rest_node_url}/dcl/pki/revocation-points/{issuer_subject_key_id}").json() else: @@ -268,97 +396,55 @@ def main(use_main_net_dcld: str, use_test_net_dcld: str, use_main_net_http: bool continue # 2. Parse the certificate - crl_signer_certificate = x509.load_pem_x509_certificate(bytes(revocation_point["crlSignerCertificate"], 'utf-8')) - - vid = revocation_point["vid"] - pid = revocation_point["pid"] - is_paa = revocation_point["isPAA"] - - # 3. && 4. Validate VID/PID - crl_vid, crl_pid = parse_vid_pid_from_distinguished_name(crl_signer_certificate.subject) - - if is_paa: - if crl_vid is not None: - if vid != crl_vid: - logging.warning("VID is not CRL VID, continue...") - continue - else: - if crl_vid is None or vid != crl_vid: - logging.warning("VID is not CRL VID, continue...") - continue - if crl_pid is not None: - if pid != crl_pid: - logging.warning("PID is not CRL PID, continue...") - continue - - # 5. Validate the certification path containing CRLSignerCertificate. - crl_signer_issuer_name = base64.b64encode(crl_signer_certificate.issuer.public_bytes()).decode('utf-8') - - crl_signer_authority_key_id = crl_signer_certificate.extensions.get_extension_for_oid( - x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier - - # Convert CRL Signer AKID to colon separated hex - crl_signer_authority_key_id = crl_signer_authority_key_id.hex().upper() - crl_signer_authority_key_id = ':'.join([crl_signer_authority_key_id[i:i+2] - for i in range(0, len(crl_signer_authority_key_id), 2)]) - - paa_certificate = dcld_client.get_paa_cert_for_crl_issuer(crl_signer_issuer_name, crl_signer_authority_key_id) - - if paa_certificate is None: - logging.warning("PAA Certificate not found, continue...") + try: + crl_signer_certificate = x509.load_pem_x509_certificate(bytes(revocation_point["crlSignerCertificate"], 'utf-8')) + except Exception: + logging.warning("CRL Signer Certificate is not valid, continue...") continue - paa_certificate_object = x509.load_pem_x509_certificate(bytes(paa_certificate, 'utf-8')) + # Parse the crl signer delegator + crl_signer_delegator_cert = None + if "crlSignerDelegator" in revocation_point: + crl_signer_delegator_cert_pem = revocation_point["crlSignerDelegator"] + logging.debug(f"CRLSignerDelegator: {crl_signer_delegator_cert_pem}") + try: + crl_signer_delegator_cert = x509.load_pem_x509_certificate(bytes(crl_signer_delegator_cert_pem, 'utf-8')) + except Exception: + logging.warning("CRL Signer Delegator Certificate not found...") - # TODO: use verify_directly_issued_by() method when we upgrade cryptography to v40.0.0 - # Verify issuer matches with subject - if crl_signer_certificate.issuer != paa_certificate_object.subject: - logging.warning("CRL Signer Certificate issuer does not match with PAA Certificate subject, continue...") + # 3. and 4. Validate VID/PID + if not validate_vid_pid(revocation_point, crl_signer_certificate, crl_signer_delegator_cert): + logging.warning("Failed to validate VID/PID, continue...") continue - # Check crl signers AKID matches with SKID of paa_certificate_object's AKID - paa_skid = paa_certificate_object.extensions.get_extension_for_oid(x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier - crl_akid = crl_signer_certificate.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier - if paa_skid != crl_akid: - logging.warning("CRL Signer's AKID does not match with PAA Certificate SKID, continue...") + # 5. Validate the certification path containing CRLSignerCertificate. + paa_certificate_object = dcld_client.get_issuer_cert(crl_signer_certificate) + if paa_certificate_object is None: + logging.warning("PAA Certificate not found, continue...") continue - # verify if PAA singed the crl signer certificate - try: - paa_certificate_object.public_key().verify(crl_signer_certificate.signature, - crl_signer_certificate.tbs_certificate_bytes, - ec.ECDSA(crl_signer_certificate.signature_hash_algorithm)) - except Exception: - logging.warning("CRL Signer Certificate is not signed by PAA Certificate, continue...") + if validate_cert_chain(crl_signer_certificate, crl_signer_delegator_cert, paa_certificate_object) is False: + logging.warning("Failed to validate CRL Signer Certificate chain, continue...") continue # 6. Obtain the CRL - logging.debug(f"Fetching CRL from {revocation_point['dataURL']}") - try: - r = requests.get(revocation_point["dataURL"], timeout=5) - except Exception: - logging.error('Failed to fetch CRL') - continue - - try: - crl_file = x509.load_der_x509_crl(r.content) - except Exception: - logging.error('Failed to load CRL') + crl_file = fetch_crl_from_url(revocation_point["dataURL"], 5) # timeout in seconds + if crl_file is None: continue # 7. Perform CRL File Validation - crl_authority_key_id = crl_file.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier - crl_signer_subject_key_id = crl_signer_certificate.extensions.get_extension_for_oid( - x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier - if crl_authority_key_id != crl_signer_subject_key_id: - logging.warning("CRL Authority Key ID is not CRL Signer Subject Key ID, continue...") + # a. + crl_signer_skid = get_skid(crl_signer_certificate) + crl_akid = get_akid(crl_file) + if crl_akid != crl_signer_skid: + logging.warning("CRL AKID is not CRL Signer SKID, continue...") continue - issuer_subject_key_id = ''.join('{:02X}'.format(x) for x in crl_authority_key_id) + crl_akid_hex = ''.join('{:02X}'.format(x) for x in crl_akid) # b. - same_issuer_points = dcld_client.get_revocations_points_by_skid(issuer_subject_key_id) - count_with_matching_vid_issuer_skid = sum(item.get('vid') == vid for item in same_issuer_points) + same_issuer_points = dcld_client.get_revocations_points_by_skid(crl_akid_hex) + count_with_matching_vid_issuer_skid = sum(item.get('vid') == revocation_point["vid"] for item in same_issuer_points) if count_with_matching_vid_issuer_skid > 1: try: @@ -377,40 +463,61 @@ def main(use_main_net_dcld: str, use_test_net_dcld: str, use_main_net_http: bool logging.warning("CRL Issuing Distribution Point URI is not CRL URL, continue...") continue - # 9. Assign CRL File Issuer - certificate_authority_name = base64.b64encode(crl_file.issuer.public_bytes()).decode('utf-8') - logging.debug(f"CRL File Issuer: {certificate_authority_name}") + # TODO: 8. Validate CRL as per Section 6.3 of RFC 5280 + + # 9. decide on certificate authority name and AKID + if revocation_point["isPAA"] and not is_self_signed_certificate(crl_signer_certificate): + certificate_authority_name_b64 = get_subject_b64(paa_certificate_object) + certificate_akid = get_skid(paa_certificate_object) + elif crl_signer_delegator_cert: + certificate_authority_name_b64 = get_subject_b64(crl_signer_delegator_cert) + certificate_akid = get_skid(crl_signer_delegator_cert) + else: + certificate_authority_name_b64 = get_subject_b64(crl_signer_certificate) + certificate_akid = get_skid(crl_signer_certificate) + + # validate issuer skid matchces with the one in revocation points + certificate_akid_hex = ''.join('{:02X}'.format(x) for x in certificate_akid) + + logging.debug(f"Certificate Authority Name: {certificate_authority_name_b64}") + logging.debug(f"Certificate AKID: {certificate_akid_hex}") + logging.debug(f"revocation_point['issuerSubjectKeyID']: {revocation_point['issuerSubjectKeyID']}") + + if revocation_point["issuerSubjectKeyID"] != certificate_akid_hex: + logging.warning("CRL Issuer Subject Key ID is not CRL Signer Subject Key ID, continue...") + continue serialnumber_list = [] # 10. Iterate through the Revoked Certificates List for revoked_cert in crl_file: - # a. try: revoked_cert_issuer = revoked_cert.extensions.get_extension_for_oid( x509.CRLEntryExtensionOID.CERTIFICATE_ISSUER).value.get_values_for_type(x509.DirectoryName).value if revoked_cert_issuer is not None: - if revoked_cert_issuer != certificate_authority_name: + # check if this really are the same thing + if revoked_cert_issuer != certificate_authority_name_b64: logging.warning("CRL Issuer is not CRL File Issuer, continue...") continue except Exception: + logging.warning("certificateIssuer entry extension not found in CRL") pass - # b. - # TODO: Verify that the certificate chain of the entry is linking to the same PAA - # that issued the CRLSignerCertificate for this entry, including path through - # CRLSignerDelegator if present. If the PAAs under which were issued the certificate - # and the CRLSignerCertificate are different, ignore the entry. - - # c. and d. serialnumber_list.append(bytes(str('{:02X}'.format(revoked_cert.serial_number)), 'utf-8').decode('utf-8')) - issuer_name = base64.b64encode(crl_file.issuer.public_bytes()).decode('utf-8') + entry = { + "type": "revocation_set", + "issuer_subject_key_id": certificate_akid_hex, + "issuer_name": certificate_authority_name_b64, + "revoked_serial_numbers": serialnumber_list, + "crl_signer_cert": revocation_point["crlSignerCertificate"], + } + + if "crlSignerDelegator" in revocation_point: + entry["crl_signer_delegator"] = revocation_point["crlSignerDelegator"] - revocation_set.append({"type": "revocation_set", - "issuer_subject_key_id": issuer_subject_key_id, - "issuer_name": issuer_name, - "revoked_serial_numbers": serialnumber_list}) + logging.debug(f"Entry to append: {entry}") + revocation_set.append(entry) with open(output, 'w+') as outfile: json.dump(revocation_set, outfile, indent=4) diff --git a/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md b/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md index a19336a593..ad509ea57a 100644 --- a/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md +++ b/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md @@ -48,11 +48,11 @@ Note that the output should also be verified against the spec using the - Goal: get zap to understand the new cluster so it can be used on devices (XML and glue) -![](../getting_started/img/zap_compiler.png) +![](../zap_and_codegen/img/zap_compiler.png) ### Cluster definitions and ZAP -Please see [ZAP](../getting_started/zap.md) for an introduction to ZAP. +Please see [ZAP](../zap_and_codegen/zap_intro.md) for an introduction to ZAP. After implementing the changes outlined in the wiki article, your cluster and device type should show up in zap. you can check this by running zaptool with @@ -64,17 +64,17 @@ To ensure the cluster and device type are correctly implemented for ZAP, open the endpoint configuration and ensure the device type appears in the device type list. -![](../getting_started/img/zap3.png) +![](../zap_and_codegen/img/zap3.png) Next, check your cluster. The "domain" parameter in the XML controls which group the cluster is in. It should have all the expected attributes, commands and events. -![](../getting_started/img/zap4.png) +![](../zap_and_codegen/img/zap4.png) Last, ensure that your attributes have the storage option set appropriately. -![](../getting_started/img/zap5.png) +![](../zap_and_codegen/img/zap5.png) ### Cluster implementation - Ember and overrides diff --git a/docs/getting_started/changing_examples.md b/docs/getting_started/changing_examples.md index 611610ce43..02ba357d86 100644 --- a/docs/getting_started/changing_examples.md +++ b/docs/getting_started/changing_examples.md @@ -4,10 +4,10 @@ The composition of most examples in the SDK is static and code generated. The tool used to describe and change the composition of an example is called ZAP. More information about ZAP and a walk-through of the tool can be found in -the [ZAP introduction](./zap.md). The composition of the device is captured in a -.zap file, which is readable by the ZAP tool. This is then compiled into a -human-readable .matter file, which is used to build the static features of the -example. +the [ZAP introduction](../zap_and_codegen/zap_intro.md). The composition of the +device is captured in a .zap file, which is readable by the ZAP tool. This is +then compiled into a human-readable .matter file, which is used to build the +static features of the example. To change the composition of a device example, you need to @@ -35,7 +35,8 @@ This will open the ZAP GUI tool, which can be used to change the endpoint composition, clusters, features, attributes, commands and events exposed by the device. -Details of how to use the tool can be found in the [ZAP Introduction](./zap.md). +Details of how to use the tool can be found in the +[ZAP Introduction](../zap_and_codegen/zap_intro.md). ## Running code generation @@ -62,3 +63,16 @@ recompile the .zap files for all the examples and the controller. After generating the .matter file, re-build the example. Instructions for building examples are given in [Building your first example](./first_example.md) + +## Ensuring device conformance + +After changing the examples, it is important to ensure they remain spec +compliant. Although there are numerous certification tests to check the various +parts of the device, the tests most likely to be affected by changes to ZAP are +the conformance tests, which ensure that the device included meets the +conformance requirements for clusters and device types. To run conformance tests +against the example app, see [Testing](../testing/index.md). The tests that +ensure the device composition is spec compliant are found in +[Device Basic Composition Test](../../src/python_testing/TC_DeviceBasicComposition.py) +and +[Device Conformance Tests](../../src/python_testing/TC_DeviceConformance.py). diff --git a/docs/getting_started/first_example.md b/docs/getting_started/first_example.md index d75d9e7b1a..7b005f3adc 100644 --- a/docs/getting_started/first_example.md +++ b/docs/getting_started/first_example.md @@ -37,7 +37,7 @@ for testing. More information about the python controller can be found in the The examples directory contains a set of apps using an example device composition \.zap file. For more information about device composition and zap, -see [ZAP documentation](./zap.md). +see [ZAP documentation](../zap_and_codegen/zap_intro.md). This quick start guide will walk you through diff --git a/docs/getting_started/index.md b/docs/getting_started/index.md index 1bfbe3f57c..fc8b9bd171 100644 --- a/docs/getting_started/index.md +++ b/docs/getting_started/index.md @@ -10,11 +10,9 @@ The following docs are a brief introduction to SDK development. first_example changing_examples SDKBasics -zap ``` - [Running your first example](./first_example.md) - [Changing examples](./changing_examples.md) - [SDK Architecture Overview](./SDKBasics.md) -- [ZAP Introduction](./zap.md) diff --git a/docs/guides/simulated_device_linux.md b/docs/guides/simulated_device_linux.md index db7e6bc4ef..eb4d6d7564 100644 --- a/docs/guides/simulated_device_linux.md +++ b/docs/guides/simulated_device_linux.md @@ -19,8 +19,8 @@ is defined by a ZAP config file and tests can be added with a - [Building Prerequisites](./BUILDING.md#prerequisites) - [Prepare For Building](./BUILDING.md#prepare-for-building) -- [Code Generate](../code_generation.md) -- [ZAP Installed](../code_generation.md#installing-zap-and-environment-variables) +- [Code Generate](../zap_and_codegen/code_generation.md) +- [ZAP Installed](../zap_and_codegen/code_generation.md#installing-zap-and-environment-variables) ## Building the default Simulated App with Script diff --git a/docs/ERROR_CODES.md b/docs/ids_and_codes/ERROR_CODES.md similarity index 100% rename from docs/ERROR_CODES.md rename to docs/ids_and_codes/ERROR_CODES.md diff --git a/docs/ids_and_codes/index.md b/docs/ids_and_codes/index.md new file mode 100644 index 0000000000..ef87b9ca01 --- /dev/null +++ b/docs/ids_and_codes/index.md @@ -0,0 +1,10 @@ +# IDs and Codes + + +```{toctree} +:glob: +:maxdepth: 1 + +* + +``` diff --git a/docs/spec_clusters.md b/docs/ids_and_codes/spec_clusters.md similarity index 100% rename from docs/spec_clusters.md rename to docs/ids_and_codes/spec_clusters.md diff --git a/docs/zap_clusters.md b/docs/ids_and_codes/zap_clusters.md similarity index 100% rename from docs/zap_clusters.md rename to docs/ids_and_codes/zap_clusters.md diff --git a/docs/index.md b/docs/index.md index 89e4661e2a..cd5fe17d10 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,6 +10,7 @@ VSCODE_DEVELOPMENT ci-cd/index development_controllers/index getting_started/index +ids_and_codes/index cluster_and_device_type_dev/index guides/index platforms/index @@ -19,14 +20,10 @@ product_considerations/index testing/index tips_and_troubleshooting/index tools/index +zap_and_codegen/index BUG_REPORT -code_generation -zap_clusters -spec_clusters upgrading -ERROR_CODES issue_triage - ``` ```{include} README.md diff --git a/docs/platforms/nxp/nxp_manufacturing_flow.md b/docs/platforms/nxp/nxp_manufacturing_flow.md index 08e09c8663..28618b276a 100644 --- a/docs/platforms/nxp/nxp_manufacturing_flow.md +++ b/docs/platforms/nxp/nxp_manufacturing_flow.md @@ -148,7 +148,7 @@ Here is the interpretation of the **optional** parameters: ## 4. Build app and usage -Use `chip_with_factory_data=1` when compiling to enable factory data usage. +Use `nxp_use_factory_data=true` when compiling to enable factory data usage. Run chip-tool with a new PAA: @@ -177,7 +177,7 @@ Implementation of manufacturing data provisioning has been validated using test certificates generated by `OpenSSL 1.1.1l`. Also, demo **DAC**, **PAI** and **PAA** certificates needed in case -`chip_with_factory_data=1` is used can be found in +`nxp_use_factory_data=true` is used can be found in `./scripts/tools/nxp/demo_generated_certs`. ## 6. Increased security for DAC private key @@ -207,7 +207,7 @@ python3 ./scripts/tools/nxp/factory_data_generator/generate.py -i 10000 -s UXKLz There is no need for an extra binary. - Write factory data binary. -- Build the application with `chip_with_factory_data=1` set. +- Build the application with `nxp_use_factory_data=true` set. - Write the application to the board and use it as usual. Factory data should now contain a corresponding encrypted blob instead of the @@ -236,19 +236,19 @@ Supported platforms: there are three implementations for factory data protection -- whole factory data protection with AES encryption ( chip_with_factory_data=1 - chip_enable_secure_whole_factory_data=true ) +- whole factory data protection with AES encryption ( + nxp_use_factory_data=true nxp_enable_secure_whole_factory_data=true ) `examples/platform/nxp/rt/rw61x/factory_data/source/AppFactoryDataExample.cpp`\ `src/platform/nxp/rt/rw61x/FactoryDataProviderEncImpl.cpp` -- only dac private key protection ( chip_with_factory_data=1 - chip_enable_secure_dac_private_key_storage=true ) +- only dac private key protection ( nxp_use_factory_data=true + nxp_enable_secure_dac_private_key_storage=true ) `examples/platform/nxp/rt/rw61x/factory_data/source/AppFactoryDataExample.cpp` \ `src/platform/nxp/rt/rw61x/FactoryDataProviderImpl.cpp` - whole factory data protection with hard-coded AES key ( - chip_with_factory_data=1 ) + nxp_use_factory_data=true ) `examples/platform/nxp/common/factory_data/source/AppFactoryDataDefaultImpl.cpp` \ `src/platform/nxp/common/factory_data/FactoryDataProviderFwkImpl.cpp` diff --git a/docs/platforms/nxp/nxp_mcxw71_ota_guide.md b/docs/platforms/nxp/nxp_mcxw71_ota_guide.md index b21bf933d7..c8d97b7ade 100644 --- a/docs/platforms/nxp/nxp_mcxw71_ota_guide.md +++ b/docs/platforms/nxp/nxp_mcxw71_ota_guide.md @@ -61,7 +61,7 @@ version. A user can update the factory data through OTA, at the same time the application firmware is updated by enabling the following processor in the `gn args`: -- `chip_enable_ota_factory_data_processor=1` to enable default factory data +- `nxp_enable_ota_factory_data_processor=true` to enable default factory data update processor (disabled by default). The OTA image used must be updated to include the new factory data. diff --git a/docs/code_generation.md b/docs/zap_and_codegen/code_generation.md similarity index 98% rename from docs/code_generation.md rename to docs/zap_and_codegen/code_generation.md index bf5b6f3036..e6ff51b318 100644 --- a/docs/code_generation.md +++ b/docs/zap_and_codegen/code_generation.md @@ -197,6 +197,11 @@ via `-o/--output-dir`. ./scripts/tools/zap/generate.py $PATH_TO_ZAP_FILE ``` +Rebuild the application. + +It is also recommended to run device composition tests to ensure the selected +composition is spec compliant (see [Testing](../testing)) + ### Compile-time code generation / pre-generated code A subset of code generation (both `codegen.py` and `zap-cli`) is done at compile diff --git a/docs/getting_started/img/zap1.png b/docs/zap_and_codegen/img/zap1.png similarity index 100% rename from docs/getting_started/img/zap1.png rename to docs/zap_and_codegen/img/zap1.png diff --git a/docs/getting_started/img/zap2.png b/docs/zap_and_codegen/img/zap2.png similarity index 100% rename from docs/getting_started/img/zap2.png rename to docs/zap_and_codegen/img/zap2.png diff --git a/docs/getting_started/img/zap3.png b/docs/zap_and_codegen/img/zap3.png similarity index 100% rename from docs/getting_started/img/zap3.png rename to docs/zap_and_codegen/img/zap3.png diff --git a/docs/getting_started/img/zap4.png b/docs/zap_and_codegen/img/zap4.png similarity index 100% rename from docs/getting_started/img/zap4.png rename to docs/zap_and_codegen/img/zap4.png diff --git a/docs/getting_started/img/zap5.png b/docs/zap_and_codegen/img/zap5.png similarity index 100% rename from docs/getting_started/img/zap5.png rename to docs/zap_and_codegen/img/zap5.png diff --git a/docs/getting_started/img/zap6.png b/docs/zap_and_codegen/img/zap6.png similarity index 100% rename from docs/getting_started/img/zap6.png rename to docs/zap_and_codegen/img/zap6.png diff --git a/docs/getting_started/img/zap_compiler.png b/docs/zap_and_codegen/img/zap_compiler.png similarity index 100% rename from docs/getting_started/img/zap_compiler.png rename to docs/zap_and_codegen/img/zap_compiler.png diff --git a/docs/zap_and_codegen/index.md b/docs/zap_and_codegen/index.md new file mode 100644 index 0000000000..7301f03b21 --- /dev/null +++ b/docs/zap_and_codegen/index.md @@ -0,0 +1,8 @@ +# ZAP and Codegen + +```{toctree} +:glob: +:maxdepth: 1 + +* +``` diff --git a/docs/getting_started/zap.md b/docs/zap_and_codegen/zap_intro.md similarity index 100% rename from docs/getting_started/zap.md rename to docs/zap_and_codegen/zap_intro.md diff --git a/examples/air-quality-sensor-app/silabs/BUILD.gn b/examples/air-quality-sensor-app/silabs/BUILD.gn index ed3077a3f1..958918e0d5 100644 --- a/examples/air-quality-sensor-app/silabs/BUILD.gn +++ b/examples/air-quality-sensor-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -38,7 +38,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/air-quality-sensor-app/silabs/README.md b/examples/air-quality-sensor-app/silabs/README.md index 7279e23457..b2687c6cad 100644 --- a/examples/air-quality-sensor-app/silabs/README.md +++ b/examples/air-quality-sensor-app/silabs/README.md @@ -257,6 +257,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni b/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni index 718600a811..8b5ccad9eb 100644 --- a/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni +++ b/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni @@ -15,7 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") chip_enable_wifi = true chip_enable_ota_requestor = true app_data_model = diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 9c442d6652..5cf2c9aab8 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:90 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:90 - Setup build environment: diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index 2cec0c3209..72807a1618 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -26,6 +26,7 @@ menu "Demo" default DEVICE_TYPE_ESP32_C3_DEVKITM if IDF_TARGET_ESP32C3 default DEVICE_TYPE_ESP32_C2_DEVKITM if IDF_TARGET_ESP32C2 default DEVICE_TYPE_ESP32_C6_DEVKITC if IDF_TARGET_ESP32C6 + default DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD if IDF_TARGET_ESP32P4 help Specifies the type of ESP32 device. @@ -57,6 +58,9 @@ menu "Demo" config DEVICE_TYPE_ESP32_H2_DEVKITM bool "ESP32H2-DevKitM" depends on IDF_TARGET_ESP32H2 + config DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD + bool "ESP32P4 Function EV Board" + depends on IDF_TARGET_ESP32P4 endchoice choice @@ -87,7 +91,7 @@ menu "Demo" config TFT_PREDEFINED_DISPLAY_TYPE int range 0 5 - default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC default 3 if DEVICE_TYPE_M5STACK default 4 if DEVICE_TYPE_ESP32_WROVER_KIT @@ -118,7 +122,7 @@ menu "Demo" range 0 40 default 2 if DEVICE_TYPE_ESP32_DEVKITC #Use LED1 (blue LED) as status LED on DevKitC default 2 if DEVICE_TYPE_ESP32_ETHERNET_KIT - default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD default 26 if DEVICE_TYPE_ESP32_WROVER_KIT default 40 if DEVICE_TYPE_M5STACK help diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 new file mode 100644 index 0000000000..3211b306b2 --- /dev/null +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 @@ -0,0 +1,37 @@ +CONFIG_IDF_TARGET="esp32p4" + +# Flash size and partition +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# Enable BLE Host but use remote controller +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_ENABLE_BT=y + +# Increase main task stack size +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 + +# Disable Wi-Fi Soft AP +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n + +# LwIP +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 + +# mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Matter shell +CONFIG_ENABLE_CHIP_SHELL=y + +# OTA requestor +CONFIG_ENABLE_OTA_REQUESTOR=y + +# Do not deinit BLE after commissioning +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n + +# ESP32-P4 Function EV Board use ESP32C6 as slave device +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y diff --git a/examples/all-clusters-app/linux/with_pw_rpc.gni b/examples/all-clusters-app/linux/with_pw_rpc.gni index 0f1ab1ea89..a67251431a 100644 --- a/examples/all-clusters-app/linux/with_pw_rpc.gni +++ b/examples/all-clusters-app/linux/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -39,4 +39,3 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true -chip_use_pw_logging = true diff --git a/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h index 5e4a6b1e4f..d39e2dc0c0 100644 --- a/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h @@ -143,15 +143,6 @@ */ #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn b/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn index 16e0b03e01..beca71ac10 100644 --- a/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn +++ b/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn @@ -167,7 +167,7 @@ rt_executable("all_cluster_app") { "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/all-clusters-app/nxp/rt/rt1060/README.md b/examples/all-clusters-app/nxp/rt/rt1060/README.md index 558ae4127f..96822ff6eb 100644 --- a/examples/all-clusters-app/nxp/rt/rt1060/README.md +++ b/examples/all-clusters-app/nxp/rt/rt1060/README.md @@ -393,14 +393,14 @@ thermostat application for now. - Build Matter with Border Router configuration with ble-wifi commissioning: ``` -user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true w8801_transceiver=true chip_enable_matter_cli=true chip_config_network_layer_ble=true chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/path/to/ot-rcp/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\" hci_spinel_single_uart=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true w8801_transceiver=true nxp_enable_matter_cli=true chip_config_network_layer_ble=true chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/path/to/ot-rcp/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\" hci_spinel_single_uart=true" out/debug user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug ``` - Build Matter with Border Router configuration with onnetwork commissioning: ``` -user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true w8801_transceiver=true chip_enable_matter_cli=true chip_config_network_layer_ble=false wifi_auto_connect_at_boot=true wifi_auto_connect_at_boot_ssid=\"your_wifi_ssid\" wifi_auto_connect_at_boot_password=\"your_wifi_password\" chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/path/to/ot-rcp/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\"" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true w8801_transceiver=true nxp_enable_matter_cli=true chip_config_network_layer_ble=false wifi_auto_connect_at_boot=true wifi_auto_connect_at_boot_ssid=\"your_wifi_ssid\" wifi_auto_connect_at_boot_password=\"your_wifi_password\" chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/path/to/ot-rcp/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\"" out/debug user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug ``` @@ -419,15 +419,15 @@ Optional GN options that can be added when building an application: Wifi + OpenThread Border Router configuration. Note that is only supported on the on the thermostat application for now. - To enable the [matter CLI](README.md#matter-shell), the argument - `chip_enable_matter_cli=true` must be added to the _gn gen_ command. + `nxp_enable_matter_cli=true` must be added to the _gn gen_ command. - To build the application in debug mode, the argument `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. - By default, the MIMXRT1060-EVK-B will be chosen. To switch to an MIMXRT1060-EVK, the argument `evkname=\"evkmimxrt1060\"` must be added to the _gn gen_ command. - To build with the option to have Matter certificates/keys pre-loaded in a - specific flash area the argument `chip_with_factory_data=1` must be added to - the _gn gen_ command. For more information, see + specific flash area the argument `nxp_use_factory_data=true` must be added + to the _gn gen_ command. For more information, see [Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) diff --git a/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h index dd73c6c9ea..61be086710 100644 --- a/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h @@ -167,15 +167,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn b/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn index 724a6e89ec..70a0a4d640 100644 --- a/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn +++ b/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn @@ -153,7 +153,7 @@ rt_executable("all_cluster_app") { "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/all-clusters-app/nxp/rt/rt1170/README.md b/examples/all-clusters-app/nxp/rt/rt1170/README.md index 7ff91872a4..8b99298204 100644 --- a/examples/all-clusters-app/nxp/rt/rt1170/README.md +++ b/examples/all-clusters-app/nxp/rt/rt1170/README.md @@ -218,7 +218,7 @@ thermostat application for now. (ble-wifi) : ``` -user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt11170$ gn gen --args="chip_enable_wifi=true iwx12_transceiver=true chip_config_network_layer_ble=true chip_enable_ble=true chip_enable_openthread=true chip_enable_matter_cli=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt11170$ gn gen --args="chip_enable_wifi=true iwx12_transceiver=true chip_config_network_layer_ble=true chip_enable_ble=true chip_enable_openthread=true nxp_enable_matter_cli=true" out/debug user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1170$ ninja -C out/debug ``` @@ -238,13 +238,13 @@ Optional GN options that can be added when building an application: on the on the thermostat application for now. - To enable the [matter CLI](#testing-the-all-clusters-application-with-matter-cli-enabled), - the argument `chip_enable_matter_cli=true` must be added to the _gn gen_ + the argument `nxp_enable_matter_cli=true` must be added to the _gn gen_ command. - To build the application in debug mode, the argument `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. - To build with the option to have Matter certificates/keys pre-loaded in a - specific flash area the argument `chip_with_factory_data=1` must be added to - the _gn gen_ command. For more information, see + specific flash area the argument `nxp_use_factory_data=true` must be added + to the _gn gen_ command. For more information, see [Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) - To build the application with the OTA Requestor enabled, the arguments `chip_enable_ota_requestor=true no_mcuboot=false` must be added to the _gn diff --git a/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h index dd73c6c9ea..61be086710 100644 --- a/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h @@ -167,15 +167,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn index 19fa822ec2..73f2153838 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn +++ b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn @@ -56,8 +56,8 @@ rt_sdk("sdk") { defines = [] # To be moved, temporary mbedtls config fix to build app with factory data - if (chip_enable_secure_dac_private_key_storage || - chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_dac_private_key_storage || + nxp_enable_secure_whole_factory_data) { defines += [ "MBEDTLS_NIST_KW_C", "MBEDTLS_PSA_CRYPTO_CLIENT", @@ -141,10 +141,10 @@ rt_executable("all_cluster_app") { "../../common/main/main.cpp", ] - if (chip_enable_secure_dac_private_key_storage || - chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_dac_private_key_storage || + nxp_enable_secure_whole_factory_data) { sources += [ "${chip_root}/examples/platform/nxp/${nxp_platform}/factory_data/source/AppFactoryDataExample.cpp" ] - if (chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_whole_factory_data) { defines += [ "ENABLE_SECURE_WHOLE_FACTORY_DATA" ] } } else { @@ -184,7 +184,7 @@ rt_executable("all_cluster_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/all-clusters-app/nxp/rt/rw61x/README.md b/examples/all-clusters-app/nxp/rt/rw61x/README.md index 9b19031c00..455073d390 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/README.md +++ b/examples/all-clusters-app/nxp/rt/rw61x/README.md @@ -137,7 +137,7 @@ thermostat application for now. (ble-wifi) : ``` -user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ gn gen --args="chip_enable_wifi=true chip_enable_openthread=true chip_enable_matter_cli=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ gn gen --args="chip_enable_wifi=true chip_enable_openthread=true nxp_enable_matter_cli=true" out/debug user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ ninja -C out/debug ``` @@ -157,7 +157,7 @@ Optional GN options that can be added when building an application: on the on the thermostat application for now. - To enable the [matter CLI](README.md#testing-the-all-clusters-application-with-matter-cli-enabled), - the argument `chip_enable_matter_cli=true` must be added to the _gn gen_ + the argument `nxp_enable_matter_cli=true` must be added to the _gn gen_ command. - By default, the `NXP RD-RW612-BGA` board revision will be chosen. To switch to `NXP FRDM-RW612` board revision, the argument `board_version=\"frdm\"` @@ -165,8 +165,8 @@ Optional GN options that can be added when building an application: - To build the application in debug mode, the argument `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. - To build with the option to have Matter certificates/keys pre-loaded in a - specific flash area the argument `chip_with_factory_data=1` must be added to - the _gn gen_ command. (for more information see + specific flash area the argument `nxp_use_factory_data=true` must be added + to the _gn gen_ command. (for more information see [Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md). - To build the application with the OTA Requestor enabled, the arguments `chip_enable_ota_requestor=true no_mcuboot=false` must be added to the _gn @@ -187,13 +187,13 @@ software key before flashing them to the device flash. Using DAC private key secure usage: Experimental feature, contain some limitation: potential concurrent access issue during sign with dac key operation due to the lack of protection between multiple access to `ELS` crypto module. -The argument `chip_enable_secure_dac_private_key_storage=1` must be added to the -_gn gen_ command to enable secure private DAC key usage with S50. -`chip_with_factory_data=1` must have been added to the _gn gen_ command +The argument `nxp_enable_secure_dac_private_key_storage=true` must be added to +the _gn gen_ command to enable secure private DAC key usage with S50. +`nxp_use_factory_data=true` must have been added to the _gn gen_ command DAC private key generation: The argument `chip_convert_dac_private_key=1` must be added to the _gn gen_ command to enable DAC private plain key conversion to -blob with S50. `chip_enable_secure_dac_private_key_storage=1` must have been +blob with S50. `nxp_enable_secure_dac_private_key_storage=1` must have been added to the _gn gen_ command `ELS` contain concurrent access risks. They must be fixed before enabling it by diff --git a/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h index 2653e97705..33a42909f4 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h @@ -168,15 +168,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index b120d9c4bf..447d950be3 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:90 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:90 ``` - Setup build environment: diff --git a/examples/android/CHIPTest/BUILD.gn b/examples/android/CHIPTest/BUILD.gn index c8ccb2e614..7dee07e6f6 100644 --- a/examples/android/CHIPTest/BUILD.gn +++ b/examples/android/CHIPTest/BUILD.gn @@ -39,6 +39,7 @@ shared_library("jni") { "${chip_root}/src/platform/android:java", "${chip_root}/src/platform/android:logging", "${chip_root}/src/platform/tests:tests", + "${chip_root}/src/pw_backends/assert:assert.impl", "${chip_root}/third_party/inipp", "${chip_root}/third_party/nlfaultinjection:nlfaultinjection", ] diff --git a/examples/android/CHIPTest/args.gni b/examples/android/CHIPTest/args.gni index df7c34af9c..04ba876aeb 100644 --- a/examples/android/CHIPTest/args.gni +++ b/examples/android/CHIPTest/args.gni @@ -28,8 +28,8 @@ chip_monolithic_tests = false pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" -pw_assert_BACKEND = "$dir_pw_assert_log" -pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" pw_unit_test_BACKEND = "$dir_pw_unit_test:light" diff --git a/examples/build_overrides/efr32_sdk.gni b/examples/build_overrides/efr32_sdk.gni index d5a35449d9..ece2fd94e9 100644 --- a/examples/build_overrides/efr32_sdk.gni +++ b/examples/build_overrides/efr32_sdk.gni @@ -14,5 +14,5 @@ declare_args() { # Root directory for erf32 SDK. - efr32_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs" + silabs_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs" } diff --git a/examples/chef/chef.py b/examples/chef/chef.py index cecbf646ff..8c54ee8dbb 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -884,7 +884,7 @@ def main() -> int: """)) if options.do_clean: shell.run_cmd("rm -rf out") - shell.run_cmd("gn gen --export-compile-commands out") + shell.run_cmd("gn gen --add-export-compile-commands=* out") shell.run_cmd("ninja -C out") # diff --git a/examples/chef/common/chef-fan-control-manager.cpp b/examples/chef/common/chef-fan-control-manager.cpp index 8d9ed5ae8b..7c2aec389e 100644 --- a/examples/chef/common/chef-fan-control-manager.cpp +++ b/examples/chef/common/chef-fan-control-manager.cpp @@ -38,20 +38,45 @@ using namespace chip::app::Clusters::FanControl::Attributes; using Protocols::InteractionModel::Status; namespace { -class ChefFanControlManager : public AttributeAccessInterface, public Delegate +class ChefFanControlManager : public Delegate { public: - ChefFanControlManager(EndpointId aEndpointId) : - AttributeAccessInterface(Optional(aEndpointId), FanControl::Id), Delegate(aEndpointId) - {} + ChefFanControlManager(EndpointId aEndpointId) : Delegate(aEndpointId) {} - CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; - CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + void Init(); + void HandleFanControlAttributeChange(AttributeId attributeId, uint8_t type, uint16_t size, uint8_t * value); Status HandleStep(StepDirectionEnum aDirection, bool aWrap, bool aLowestOff) override; + DataModel::Nullable GetSpeedSetting(); + DataModel::Nullable GetPercentSetting(); private: - Nullable mPercentSetting{}; - Nullable mSpeedSetting{}; + uint8_t mPercentCurrent = 0; + uint8_t mSpeedCurrent = 0; + + // Fan Mode Limits + struct Range + { + bool Contains(int value) const { return value >= low && value <= high; } + int Low() const { return low; } + int High() const { return high; } + + int low; + int high; + }; + static constexpr Range kFanModeLowSpeedRange = { 1, 3 }; + static constexpr Range kFanModeMediumSpeedRange = { 4, 7 }; + static constexpr Range kFanModeHighSpeedRange = { 8, 10 }; + + static_assert(kFanModeLowSpeedRange.low <= kFanModeLowSpeedRange.high); + static_assert(kFanModeLowSpeedRange.high + 1 == kFanModeMediumSpeedRange.low); + static_assert(kFanModeMediumSpeedRange.high + 1 == kFanModeHighSpeedRange.low); + static_assert(kFanModeHighSpeedRange.low <= kFanModeHighSpeedRange.high); + + void FanModeWriteCallback(FanControl::FanModeEnum aNewFanMode); + void SetSpeedCurrent(uint8_t aNewSpeedCurrent); + void SetPercentCurrent(uint8_t aNewPercentCurrent); + void SetSpeedSetting(DataModel::Nullable aNewSpeedSetting); + static FanControl::FanModeEnum SpeedToFanMode(uint8_t speed); }; static std::unique_ptr mFanControlManager; @@ -99,98 +124,222 @@ Status ChefFanControlManager::HandleStep(StepDirectionEnum aDirection, bool aWra return SpeedSetting::Set(mEndpoint, newSpeedSetting); } -CHIP_ERROR ChefFanControlManager::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) +void ChefFanControlManager::HandleFanControlAttributeChange(AttributeId attributeId, uint8_t type, uint16_t size, uint8_t * value) { - VerifyOrDie(aPath.mClusterId == FanControl::Id); - VerifyOrDie(aPath.mEndpointId == mEndpoint); - - switch (aPath.mAttributeId) + ChipLogProgress(NotSpecified, "ChefFanControlManager::HandleFanControlAttributeChange"); + switch (attributeId) { - case SpeedSetting::Id: { - Nullable newSpeedSetting; - ReturnErrorOnFailure(aDecoder.Decode(newSpeedSetting)); - - // Ensure new speed is in bounds + case FanControl::Attributes::PercentSetting::Id: { + ChipLogProgress(NotSpecified, "ChefFanControlManager::HandleFanControlAttributeChange PercentSetting"); + DataModel::Nullable percentSetting; + if (!NumericAttributeTraits::IsNullValue(*value)) { - uint8_t maxSpeedSetting = 0; - Protocols::InteractionModel::Status status = SpeedMax::Get(mEndpoint, &maxSpeedSetting); - VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_IM_GLOBAL_STATUS(Failure)); - - if (!newSpeedSetting.IsNull() && newSpeedSetting.Value() > maxSpeedSetting) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } + percentSetting.SetNonNull(NumericAttributeTraits::StorageToWorking(*value)); } - - // Only act on changed. - if (newSpeedSetting != mSpeedSetting) + else { - mSpeedSetting = newSpeedSetting; - - // Mark both the setting AND the current dirty, since the current always - // tracks the target for our product. - MatterReportingAttributeChangeCallback(mEndpoint, FanControl::Id, Attributes::SpeedSetting::Id); - MatterReportingAttributeChangeCallback(mEndpoint, FanControl::Id, Attributes::SpeedCurrent::Id); + percentSetting.SetNull(); } + // The cluster code in fan-control-server.cpp is the only one allowed to set PercentSetting to null. + // This happens as a consequence of setting the FanMode to kAuto. In auto mode, percentCurrent should continue to report the + // real fan speed percentage. In this example, we set PercentCurrent to 0 here as we don't have a real value for the Fan + // speed or a FanAutoMode simulator. + // When not Null, SpeedCurrent tracks SpeedSetting's value. + SetPercentCurrent(percentSetting.ValueOr(0)); break; } - case PercentSetting::Id: { - Nullable newPercentSetting; - ReturnErrorOnFailure(aDecoder.Decode(newPercentSetting)); - // Ensure new speed in percent is valid. - if (!newPercentSetting.IsNull() && newPercentSetting.Value() > 100) + case FanControl::Attributes::SpeedSetting::Id: { + ChipLogProgress(NotSpecified, "ChefFanControlManager::HandleFanControlAttributeChange SpeedSetting"); + DataModel::Nullable speedSetting; + if (!NumericAttributeTraits::IsNullValue(*value)) { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); + speedSetting.SetNonNull(NumericAttributeTraits::StorageToWorking(*value)); } - - // Only act on changed. - if (newPercentSetting != mPercentSetting) + else { - mPercentSetting = newPercentSetting; - - // Mark both the setting AND the current dirty, since the current always - // tracks the target for our product. - MatterReportingAttributeChangeCallback(mEndpoint, FanControl::Id, Attributes::PercentSetting::Id); - MatterReportingAttributeChangeCallback(mEndpoint, FanControl::Id, Attributes::PercentCurrent::Id); + speedSetting.SetNull(); } + // The cluster code in fan-control-server.cpp is the only one allowed to set speedSetting to null. + // This happens as a consequence of setting the FanMode to kAuto. In auto mode, speedCurrent should continue to report the + // real fan speed. In this example, we set SpeedCurrent to 0 here as we don't have a real value for the Fan speed or a + // FanAutoMode simulator. + // When not Null, SpeedCurrent tracks SpeedSetting's value. + SetSpeedCurrent(speedSetting.ValueOr(0)); + // Determine if the speed change should also change the fan mode + FanControl::Attributes::FanMode::Set(mEndpoint, SpeedToFanMode(mSpeedCurrent)); break; } - default: + + case FanControl::Attributes::FanMode::Id: { + ChipLogProgress(NotSpecified, "ChefFanControlManager::HandleFanControlAttributeChange FanMode"); + + static_assert(sizeof(FanControl::FanModeEnum) == 1); + FanControl::FanModeEnum fanMode = static_cast(*value); + FanModeWriteCallback(fanMode); break; } - // Fall through goes to attribute store legacy handling. - return CHIP_NO_ERROR; + default: { + break; + } + } +} + +FanControl::FanModeEnum ChefFanControlManager::SpeedToFanMode(uint8_t speed) +{ + if (speed == 0) + { + return FanControl::FanModeEnum::kOff; + } + if (kFanModeLowSpeedRange.Contains(speed)) + { + return FanControl::FanModeEnum::kLow; + } + if (kFanModeMediumSpeedRange.Contains(speed)) + { + return FanControl::FanModeEnum::kMedium; + } + return FanControl::FanModeEnum::kHigh; } -CHIP_ERROR ChefFanControlManager::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +void ChefFanControlManager::SetPercentCurrent(uint8_t aNewPercentCurrent) { - VerifyOrDie(aPath.mClusterId == FanControl::Id); - VerifyOrDie(aPath.mEndpointId == mEndpoint); + if (aNewPercentCurrent == mPercentCurrent) + { + return; + } - switch (aPath.mAttributeId) + ChipLogDetail(NotSpecified, "ChefFanControlManager::SetPercentCurrent: %d", aNewPercentCurrent); + mPercentCurrent = aNewPercentCurrent; + Status status = FanControl::Attributes::PercentCurrent::Set(mEndpoint, mPercentCurrent); + if (status != Status::Success) { - case PercentCurrent::Id: { - // Current percents always tracks setting immediately in our implementation. - return aEncoder.Encode(mPercentSetting.ValueOr(0)); + ChipLogError(NotSpecified, "ChefFanControlManager::SetPercentCurrent: failed to set PercentCurrent attribute: %d", + to_underlying(status)); } - case PercentSetting::Id: { - return aEncoder.Encode(mPercentSetting); +} + +void ChefFanControlManager::SetSpeedCurrent(uint8_t aNewSpeedCurrent) +{ + if (aNewSpeedCurrent == mSpeedCurrent) + { + return; } - case SpeedCurrent::Id: { - // Current speed always tracks setting immediately in our implementation. - return aEncoder.Encode(mSpeedSetting.ValueOr(0)); + + ChipLogDetail(NotSpecified, "ChefFanControlManager::SetSpeedCurrent: %d", aNewSpeedCurrent); + mSpeedCurrent = aNewSpeedCurrent; + Status status = FanControl::Attributes::SpeedCurrent::Set(mEndpoint, aNewSpeedCurrent); + if (status != Status::Success) + { + ChipLogError(NotSpecified, "ChefFanControlManager::SetSpeedCurrent: failed to set SpeedCurrent attribute: %d", + to_underlying(status)); } - case SpeedSetting::Id: { - return aEncoder.Encode(mSpeedSetting); +} + +void ChefFanControlManager::FanModeWriteCallback(FanControl::FanModeEnum aNewFanMode) +{ + ChipLogDetail(NotSpecified, "ChefFanControlManager::FanModeWriteCallback: %d", to_underlying(aNewFanMode)); + switch (aNewFanMode) + { + case FanControl::FanModeEnum::kOff: { + if (mSpeedCurrent != 0) + { + DataModel::Nullable speedSetting(0); + SetSpeedSetting(speedSetting); + } + break; } - default: + case FanControl::FanModeEnum::kLow: { + if (!kFanModeLowSpeedRange.Contains(mSpeedCurrent)) + { + DataModel::Nullable speedSetting(kFanModeLowSpeedRange.Low()); + SetSpeedSetting(speedSetting); + } break; } - return CHIP_NO_ERROR; + case FanControl::FanModeEnum::kMedium: { + if (!kFanModeMediumSpeedRange.Contains(mSpeedCurrent)) + { + DataModel::Nullable speedSetting(kFanModeMediumSpeedRange.Low()); + SetSpeedSetting(speedSetting); + } + break; + } + case FanControl::FanModeEnum::kOn: + case FanControl::FanModeEnum::kHigh: { + if (!kFanModeHighSpeedRange.Contains(mSpeedCurrent)) + { + DataModel::Nullable speedSetting(kFanModeHighSpeedRange.Low()); + SetSpeedSetting(speedSetting); + } + break; + } + case FanControl::FanModeEnum::kSmart: + case FanControl::FanModeEnum::kAuto: { + ChipLogProgress(NotSpecified, "ChefFanControlManager::FanModeWriteCallback: Auto"); + break; + } + case FanControl::FanModeEnum::kUnknownEnumValue: { + ChipLogProgress(NotSpecified, "ChefFanControlManager::FanModeWriteCallback: Unknown"); + break; + } + } +} + +void ChefFanControlManager::SetSpeedSetting(DataModel::Nullable aNewSpeedSetting) +{ + if (aNewSpeedSetting.IsNull()) + { + ChipLogError(NotSpecified, "ChefFanControlManager::SetSpeedSetting: null value is invalid"); + return; + } + + if (aNewSpeedSetting.Value() != mSpeedCurrent) + { + Status status = FanControl::Attributes::SpeedSetting::Set(mEndpoint, aNewSpeedSetting); + if (status != Status::Success) + { + ChipLogError(NotSpecified, "ChefFanControlManager::SetSpeedSetting: failed to set SpeedSetting attribute: %d", + to_underlying(status)); + } + } +} + +void ChefFanControlManager::Init() +{ + SetPercentCurrent(GetPercentSetting().ValueOr(0)); + SetSpeedCurrent(GetSpeedSetting().ValueOr(0)); +} + +DataModel::Nullable ChefFanControlManager::GetPercentSetting() +{ + DataModel::Nullable percentSetting; + Status status = FanControl::Attributes::PercentSetting::Get(mEndpoint, percentSetting); + + if (status != Status::Success) + { + ChipLogError(NotSpecified, "ChefFanControlManager::GetPercentSetting: failed to get PercentSetting attribute: %d", + to_underlying(status)); + } + + return percentSetting; +} + +DataModel::Nullable ChefFanControlManager::GetSpeedSetting() +{ + DataModel::Nullable speedSetting; + Status status = FanControl::Attributes::SpeedSetting::Get(mEndpoint, speedSetting); + + if (status != Status::Success) + { + ChipLogError(NotSpecified, "ChefFanControlManager::GetSpeedSetting: failed to get SpeedSetting attribute: %d", + to_underlying(status)); + } + + return speedSetting; } } // anonymous namespace @@ -199,6 +348,11 @@ void emberAfFanControlClusterInitCallback(EndpointId endpoint) { VerifyOrDie(!mFanControlManager); mFanControlManager = std::make_unique(endpoint); - AttributeAccessInterfaceRegistry::Instance().Register(mFanControlManager.get()); FanControl::SetDefaultDelegate(endpoint, mFanControlManager.get()); + mFanControlManager->Init(); +} + +void HandleFanControlAttributeChange(AttributeId attributeId, uint8_t type, uint16_t size, uint8_t * value) +{ + mFanControlManager->HandleFanControlAttributeChange(attributeId, type, size, value); } diff --git a/src/darwin/Framework/CHIP/MTRDeviceDataValueDictionary.h b/examples/chef/common/chef-fan-control-manager.h similarity index 75% rename from src/darwin/Framework/CHIP/MTRDeviceDataValueDictionary.h rename to examples/chef/common/chef-fan-control-manager.h index 53a6b2e6f9..36a90e6a88 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceDataValueDictionary.h +++ b/examples/chef/common/chef-fan-control-manager.h @@ -1,4 +1,5 @@ -/** +/* + * * Copyright (c) 2024 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +15,8 @@ * limitations under the License. */ -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A data-value as defined in MTRBaseDevice.h. - */ -typedef NSDictionary * MTRDeviceDataValueDictionary; +#include -NS_ASSUME_NONNULL_END +#ifdef MATTER_DM_PLUGIN_FAN_CONTROL_SERVER +void HandleFanControlAttributeChange(AttributeId attributeId, uint8_t type, uint16_t size, uint8_t * value); +#endif diff --git a/examples/chef/common/chef-laundry-washer-controls-delegate-impl.cpp b/examples/chef/common/chef-laundry-washer-controls-delegate-impl.cpp index 4811b458fe..f63acf8938 100644 --- a/examples/chef/common/chef-laundry-washer-controls-delegate-impl.cpp +++ b/examples/chef/common/chef-laundry-washer-controls-delegate-impl.cpp @@ -30,8 +30,10 @@ const CharSpan LaundryWasherControlDelegate::spinSpeedsNameOptions[] = { }; const NumberOfRinsesEnum LaundryWasherControlDelegate::supportRinsesOptions[] = { + NumberOfRinsesEnum::kNone, NumberOfRinsesEnum::kNormal, NumberOfRinsesEnum::kExtra, + NumberOfRinsesEnum::kMax, }; LaundryWasherControlDelegate LaundryWasherControlDelegate::instance; diff --git a/examples/chef/common/chef-laundry-washer-mode.cpp b/examples/chef/common/chef-laundry-washer-mode.cpp index f24e1c6cbc..8ca637ca29 100644 --- a/examples/chef/common/chef-laundry-washer-mode.cpp +++ b/examples/chef/common/chef-laundry-washer-mode.cpp @@ -25,6 +25,7 @@ template using List = chip::app::DataModel::List; using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type; +#ifdef MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER static LaundryWasherModeDelegate * gLaundryWasherModeDelegate = nullptr; static ModeBase::Instance * gLaundryWasherModeInstance = nullptr; @@ -94,6 +95,61 @@ void LaundryWasherMode::Shutdown() } } +chip::Protocols::InteractionModel::Status chefLaundryWasherModeWriteCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) +{ + VerifyOrReturnError(endpointId == 1 || gLaundryWasherModeInstance != nullptr, + chip::Protocols::InteractionModel::Status::Failure); + + chip::Protocols::InteractionModel::Status ret; + chip::AttributeId attributeId = attributeMetadata->attributeId; + + switch (attributeId) + { + case chip::app::Clusters::LaundryWasherMode::Attributes::CurrentMode::Id: { + uint8_t m = buffer[0]; + ret = gLaundryWasherModeInstance->UpdateCurrentMode(m); + if (chip::Protocols::InteractionModel::Status::Success != ret) + { + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast(ret)); + } + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedWrite; + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; + } + + return ret; +} + +chip::Protocols::InteractionModel::Status chefLaundryWasherModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + VerifyOrReturnValue(maxReadLength > 0, chip::Protocols::InteractionModel::Status::ResourceExhausted); + + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + + switch (attributeId) + { + case chip::app::Clusters::LaundryWasherMode::Attributes::CurrentMode::Id: { + *buffer = gLaundryWasherModeInstance->GetCurrentMode(); + ChipLogDetail(DeviceLayer, "Reading LaundryWasherMode CurrentMode : %d", static_cast(attributeId)); + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedRead; + ChipLogDetail(DeviceLayer, "Unsupported attributeId %d from reading RvcCleanMode", static_cast(attributeId)); + break; + } + + return ret; +} + void emberAfLaundryWasherModeClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. @@ -103,3 +159,4 @@ void emberAfLaundryWasherModeClusterInitCallback(chip::EndpointId endpointId) new ModeBase::Instance(gLaundryWasherModeDelegate, 0x1, LaundryWasherMode::Id, chip::to_underlying(Feature::kOnOff)); gLaundryWasherModeInstance->Init(); } +#endif // MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER diff --git a/examples/chef/common/chef-laundry-washer-mode.h b/examples/chef/common/chef-laundry-washer-mode.h index 5d35c03d4e..ffbcc45321 100644 --- a/examples/chef/common/chef-laundry-washer-mode.h +++ b/examples/chef/common/chef-laundry-washer-mode.h @@ -82,3 +82,12 @@ void Shutdown(); } // namespace Clusters } // namespace app } // namespace chip + +#ifdef MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER +chip::Protocols::InteractionModel::Status chefLaundryWasherModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefLaundryWasherModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER diff --git a/examples/chef/common/clusters/audio-output/AudioOutputManager.cpp b/examples/chef/common/clusters/audio-output/AudioOutputManager.cpp index 65df8db9ff..776baf5ea1 100644 --- a/examples/chef/common/clusters/audio-output/AudioOutputManager.cpp +++ b/examples/chef/common/clusters/audio-output/AudioOutputManager.cpp @@ -16,15 +16,21 @@ * limitations under the License. */ +#include +#include #include +#include + #ifdef MATTER_DM_PLUGIN_AUDIO_OUTPUT_SERVER #include "AudioOutputManager.h" +using namespace chip; using namespace chip::app; using namespace chip::app::Clusters::AudioOutput; using chip::app::AttributeValueEncoder; +using chip::Protocols::InteractionModel::Status; -AudioOutputManager::AudioOutputManager() +AudioOutputManager::AudioOutputManager(chip::EndpointId endpoint) : mEndpoint(endpoint) { struct OutputData outputData1(1, chip::app::Clusters::AudioOutput::OutputTypeEnum::kHdmi, "HDMI 1"); mOutputs.push_back(outputData1); @@ -32,13 +38,17 @@ AudioOutputManager::AudioOutputManager() mOutputs.push_back(outputData2); struct OutputData outputData3(3, chip::app::Clusters::AudioOutput::OutputTypeEnum::kHdmi, "HDMI 3"); mOutputs.push_back(outputData3); - - mCurrentOutput = 1; } uint8_t AudioOutputManager::HandleGetCurrentOutput() { - return mCurrentOutput; + uint8_t currentOutput = 1; + Status status = Attributes::CurrentOutput::Get(mEndpoint, ¤tOutput); + if (Status::Success != status) + { + ChipLogError(Zcl, "Unable to get CurrentOutput attribute, err:0x%x", to_underlying(status)); + } + return currentOutput; } CHIP_ERROR AudioOutputManager::HandleGetOutputList(AttributeValueEncoder & aEncoder) @@ -72,11 +82,27 @@ bool AudioOutputManager::HandleSelectOutput(const uint8_t & index) { if (outputData.index == index) { - mCurrentOutput = index; + // Sync the CurrentOutput to attribute storage while reporting changes + Status status = Attributes::CurrentOutput::Set(mEndpoint, index); + if (Status::Success != status) + { + ChipLogError(Zcl, "CurrentOutput is not stored successfully, err:0x%x", to_underlying(status)); + } return true; } } return false; } + +static std::map> gAudioOutputManagerInstance{}; + +void emberAfAudioOutputClusterInitCallback(EndpointId endpoint) +{ + ChipLogProgress(Zcl, "TV Linux App: AudioOutput::SetDefaultDelegate, endpoint=%x", endpoint); + + gAudioOutputManagerInstance[endpoint] = std::make_unique(endpoint); + + SetDefaultDelegate(endpoint, gAudioOutputManagerInstance[endpoint].get()); +} #endif // MATTER_DM_PLUGIN_AUDIO_OUTPUT_SERVER diff --git a/examples/chef/common/clusters/audio-output/AudioOutputManager.h b/examples/chef/common/clusters/audio-output/AudioOutputManager.h index ad64b7c9c9..93c94d6f7e 100644 --- a/examples/chef/common/clusters/audio-output/AudioOutputManager.h +++ b/examples/chef/common/clusters/audio-output/AudioOutputManager.h @@ -27,7 +27,7 @@ class AudioOutputManager : public chip::app::Clusters::AudioOutput::Delegate using OutputInfoType = chip::app::Clusters::AudioOutput::Structs::OutputInfoStruct::Type; public: - AudioOutputManager(); + AudioOutputManager(chip::EndpointId endpoint); uint8_t HandleGetCurrentOutput() override; CHIP_ERROR HandleGetOutputList(chip::app::AttributeValueEncoder & aEncoder) override; @@ -54,6 +54,6 @@ class AudioOutputManager : public chip::app::Clusters::AudioOutput::Delegate }; protected: - uint8_t mCurrentOutput = 1; + chip::EndpointId mEndpoint; std::vector mOutputs; }; diff --git a/examples/chef/common/clusters/temperature-control/static-supported-temperature-levels.cpp b/examples/chef/common/clusters/temperature-control/static-supported-temperature-levels.cpp new file mode 100644 index 0000000000..045825d8fa --- /dev/null +++ b/examples/chef/common/clusters/temperature-control/static-supported-temperature-levels.cpp @@ -0,0 +1,78 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#ifdef MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER +#include "static-supported-temperature-levels.h" +#include + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::TemperatureControl; +using chip::Protocols::InteractionModel::Status; + +app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; + +CharSpan AppSupportedTemperatureLevelsDelegate::temperatureLevelOptions[] = { "Low"_span, "Medium"_span, "High"_span }; + +const AppSupportedTemperatureLevelsDelegate::EndpointPair AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints + [MATTER_DM_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT] = { EndpointPair( + 1 /* endpointId */, AppSupportedTemperatureLevelsDelegate::temperatureLevelOptions, + ArraySize(AppSupportedTemperatureLevelsDelegate::temperatureLevelOptions)) }; + +uint8_t AppSupportedTemperatureLevelsDelegate::Size() +{ + for (auto & endpointPair : AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints) + { + if (endpointPair.mEndpointId == mEndpoint) + { + return endpointPair.mSize; + } + } + return 0; +} + +CHIP_ERROR AppSupportedTemperatureLevelsDelegate::Next(MutableCharSpan & item) +{ + for (auto & endpointPair : AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints) + { + if (endpointPair.mEndpointId == mEndpoint) + { + if (endpointPair.mSize > mIndex) + { + CHIP_ERROR err = CopyCharSpanToMutableCharSpan(endpointPair.mTemperatureLevels[mIndex], item); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Error copying char span to mutable char span %s", ErrorStr(err)); + return err; + } + mIndex++; + return CHIP_NO_ERROR; + } + } + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} +void emberAfTemperatureControlClusterInitCallback(EndpointId endpoint) +{ + static_assert(MATTER_DM_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT == 1, "This cluster is only enabled for endpoint 1"); + + chip::app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); +} +#endif // MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER diff --git a/examples/chef/common/clusters/temperature-control/static-supported-temperature-levels.h b/examples/chef/common/clusters/temperature-control/static-supported-temperature-levels.h new file mode 100644 index 0000000000..c39bb171c9 --- /dev/null +++ b/examples/chef/common/clusters/temperature-control/static-supported-temperature-levels.h @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace TemperatureControl { + +class AppSupportedTemperatureLevelsDelegate : public SupportedTemperatureLevelsIteratorDelegate +{ + struct EndpointPair + { + EndpointId mEndpointId; + CharSpan * mTemperatureLevels; + uint8_t mSize; + + EndpointPair(EndpointId aEndpointId, CharSpan * TemperatureLevels, uint8_t size) : + mEndpointId(aEndpointId), mTemperatureLevels(TemperatureLevels), mSize(size) + {} + }; + + static CharSpan temperatureLevelOptions[3]; + static const EndpointPair supportedOptionsByEndpoints[MATTER_DM_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; + +public: + uint8_t Size() override; + + CHIP_ERROR Next(MutableCharSpan & item) override; + + ~AppSupportedTemperatureLevelsDelegate() {} +}; + +} // namespace TemperatureControl +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 687b572a4c..8c389028cd 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -62,10 +62,25 @@ const Clusters::Descriptor::Structs::SemanticTagStruct::Type freezerTagList[] #include "chef-dishwasher-mode-delegate-impl.h" #endif // MATTER_DM_PLUGIN_DISHWASHER_MODE_SERVER +#ifdef MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER +#include "chef-laundry-washer-mode.h" +#endif // MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER + +#ifdef MATTER_DM_PLUGIN_LAUNDRY_WASHER_CONTROLS_SERVER +#include "chef-laundry-washer-controls-delegate-impl.h" +#endif // MATTER_DM_PLUGIN_LAUNDRY_WASHER_CONTROLS_SERVER + #ifdef MATTER_DM_PLUGIN_OPERATIONAL_STATE_SERVER #include "chef-operational-state-delegate-impl.h" #endif // MATTER_DM_PLUGIN_OPERATIONAL_STATE_SERVER +#ifdef MATTER_DM_PLUGIN_FAN_CONTROL_SERVER +#include "chef-fan-control-manager.h" +#endif // MATTER_DM_PLUGIN_FAN_CONTROL_SERVER +#ifdef MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER +#include "temperature-control/static-supported-temperature-levels.h" +#endif // MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER + Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) @@ -124,6 +139,10 @@ Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(Endpoin case chip::app::Clusters::DishwasherMode::Id: return chefDishwasherModeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); #endif // MATTER_DM_PLUGIN_DISHWASHER_MODE_SERVER +#ifdef MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER + case chip::app::Clusters::LaundryWasherMode::Id: + return chefLaundryWasherModeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif // MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER #ifdef MATTER_DM_PLUGIN_OPERATIONAL_STATE_SERVER case chip::app::Clusters::OperationalState::Id: return chefOperationalStateReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); @@ -202,6 +221,10 @@ Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(Endpoi case chip::app::Clusters::DishwasherMode::Id: return chefDishwasherModeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); #endif // MATTER_DM_PLUGIN_DISHWASHER_MODE_SERVER +#ifdef MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER + case chip::app::Clusters::LaundryWasherMode::Id: + return chefLaundryWasherModeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif // MATTER_DM_PLUGIN_LAUNDRY_WASHER_MODE_SERVER #ifdef MATTER_DM_PLUGIN_OPERATIONAL_STATE_SERVER case chip::app::Clusters::OperationalState::Id: return chefOperationalStateWriteCallback(endpoint, clusterId, attributeMetadata, buffer); @@ -233,6 +256,12 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & // WIP Apply attribute change to Light } +#ifdef MATTER_DM_PLUGIN_FAN_CONTROL_SERVER + else if (clusterId == FanControl::Id) + { + HandleFanControlAttributeChange(attributeId, type, size, value); + } +#endif // MATTER_DM_PLUGIN_FAN_CONTROL_SERVER } /** @brief OnOff Cluster Init @@ -250,17 +279,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & */ void emberAfOnOffClusterInitCallback(EndpointId endpoint) {} -#ifdef MATTER_DM_PLUGIN_AUDIO_OUTPUT_SERVER -#include "audio-output/AudioOutputManager.h" -static AudioOutputManager audioOutputManager; - -void emberAfAudioOutputClusterInitCallback(EndpointId endpoint) -{ - ChipLogProgress(Zcl, "TV Linux App: AudioOutput::SetDefaultDelegate"); - AudioOutput::SetDefaultDelegate(endpoint, &audioOutputManager); -} -#endif - #ifdef MATTER_DM_PLUGIN_CHANNEL_SERVER #include "channel/ChannelManager.h" static ChannelManager channelManager; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index 78e524d7eb..1acdbca512 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -1878,7 +1878,7 @@ endpoint 1 { ram attribute fanModeSequence default = 2; persist attribute percentSetting default = 0x00; ram attribute percentCurrent default = 0x00; - ram attribute speedMax default = 100; + ram attribute speedMax default = 10; persist attribute speedSetting default = 0x00; persist attribute speedCurrent default = 0; ram attribute rockSupport default = 0x03; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap index 1f976f24c6..39239eaef9 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 103, + "featureLevel": 104, "creator": "zap", "keyValuePairs": [ { @@ -41,14 +41,16 @@ "code": 22, "profileId": 259, "label": "MA-rootdevice", - "name": "MA-rootdevice" + "name": "MA-rootdevice", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 22, "profileId": 259, "label": "MA-rootdevice", - "name": "MA-rootdevice" + "name": "MA-rootdevice", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -2291,14 +2293,16 @@ "code": 43, "profileId": 259, "label": "MA-fan", - "name": "MA-fan" + "name": "MA-fan", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 43, "profileId": 259, "label": "MA-fan", - "name": "MA-fan" + "name": "MA-fan", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -2885,7 +2889,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "100", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3035,22 +3039,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter index f38dd8f3df..2e76d3f34a 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter @@ -241,6 +241,78 @@ struct AtomicAttributeStatusStruct { status statusCode = 1; } +/** Attributes and commands for switching devices between 'On' and 'Off' states. */ +cluster OnOff = 6 { + revision 6; + + enum DelayedAllOffEffectVariantEnum : enum8 { + kDelayedOffFastFade = 0; + kNoFade = 1; + kDelayedOffSlowFade = 2; + } + + enum DyingLightEffectVariantEnum : enum8 { + kDyingLightFadeOff = 0; + } + + enum EffectIdentifierEnum : enum8 { + kDelayedAllOff = 0; + kDyingLight = 1; + } + + enum StartUpOnOffEnum : enum8 { + kOff = 0; + kOn = 1; + kToggle = 2; + } + + bitmap Feature : bitmap32 { + kLighting = 0x1; + kDeadFrontBehavior = 0x2; + kOffOnly = 0x4; + } + + bitmap OnOffControlBitmap : bitmap8 { + kAcceptOnlyWhenOn = 0x1; + } + + readonly attribute boolean onOff = 0; + readonly attribute optional boolean globalSceneControl = 16384; + attribute optional int16u onTime = 16385; + attribute optional int16u offWaitTime = 16386; + attribute access(write: manage) optional nullable StartUpOnOffEnum startUpOnOff = 16387; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OffWithEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + enum8 effectVariant = 1; + } + + request struct OnWithTimedOffRequest { + OnOffControlBitmap onOffControl = 0; + int16u onTime = 1; + int16u offWaitTime = 2; + } + + /** On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0. */ + command Off(): DefaultSuccess = 0; + /** On receipt of this command, a device SHALL enter its ‘On’ state. This state is device dependent, but it is recommended that it is used for power on or similar functions. On receipt of the On command, if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. */ + command On(): DefaultSuccess = 1; + /** On receipt of this command, if a device is in its ‘Off’ state it SHALL enter its ‘On’ state. Otherwise, if it is in its ‘On’ state it SHALL enter its ‘Off’ state. On receipt of the Toggle command, if the value of the OnOff attribute is equal to FALSE and if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. If the value of the OnOff attribute is equal to TRUE, the OnTime attribute SHALL be set to 0. */ + command Toggle(): DefaultSuccess = 2; + /** The OffWithEffect command allows devices to be turned off using enhanced ways of fading. */ + command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64; + /** The OnWithRecallGlobalScene command allows the recall of the settings when the device was turned off. */ + command OnWithRecallGlobalScene(): DefaultSuccess = 65; + /** The OnWithTimedOff command allows devices to be turned on for a specific duration with a guarded off duration so that SHOULD the device be subsequently switched off, further OnWithTimedOff commands, received during this time, are prevented from turning the devices back on. */ + command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66; +} + /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; @@ -1345,6 +1417,38 @@ cluster LaundryWasherControls = 83 { readonly attribute int16u clusterRevision = 65533; } +/** Attributes and commands for configuring the temperature control, and reporting temperature. */ +cluster TemperatureControl = 86 { + revision 1; // NOTE: Default/not specifically set + + bitmap Feature : bitmap32 { + kTemperatureNumber = 0x1; + kTemperatureLevel = 0x2; + kTemperatureStep = 0x4; + } + + readonly attribute optional temperature temperatureSetpoint = 0; + readonly attribute optional temperature minTemperature = 1; + readonly attribute optional temperature maxTemperature = 2; + readonly attribute optional temperature step = 3; + readonly attribute optional int8u selectedTemperatureLevel = 4; + readonly attribute optional char_string supportedTemperatureLevels[] = 5; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct SetTemperatureRequest { + optional temperature targetTemperature = 0; + optional int8u targetTemperatureLevel = 1; + } + + /** Set Temperature */ + command SetTemperature(SetTemperatureRequest): DefaultSuccess = 0; +} + /** This cluster supports remotely monitoring and, where supported, changing the operational state of any device where a state machine is a part of the operation. */ cluster OperationalState = 96 { revision 1; @@ -1640,6 +1744,19 @@ endpoint 1 { device type ma_laundry_washer = 115, version 1; + server cluster OnOff { + ram attribute onOff default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 2; + ram attribute clusterRevision default = 6; + + handle command Off; + handle command On; + handle command Toggle; + } + server cluster Descriptor { callback attribute deviceTypeList; callback attribute serverList; @@ -1667,8 +1784,8 @@ endpoint 1 { server cluster LaundryWasherControls { callback attribute spinSpeeds; - ram attribute spinSpeedCurrent; - ram attribute numberOfRinses; + ram attribute spinSpeedCurrent default = 1; + ram attribute numberOfRinses default = 1; callback attribute supportedRinses; callback attribute generatedCommandList; callback attribute acceptedCommandList; @@ -1677,11 +1794,24 @@ endpoint 1 { ram attribute clusterRevision default = 1; } + server cluster TemperatureControl { + ram attribute selectedTemperatureLevel default = 0; + callback attribute supportedTemperatureLevels; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 2; + ram attribute clusterRevision default = 1; + + handle command SetTemperature; + } + server cluster OperationalState { emits event OperationalError; emits event OperationCompletion; callback attribute phaseList; callback attribute currentPhase; + callback attribute countdownTime; callback attribute operationalStateList; callback attribute operationalState; callback attribute operationalError; @@ -1694,6 +1824,7 @@ endpoint 1 { handle command Pause; handle command Stop; handle command Start; + handle command Resume; handle command OperationalCommandResponse; } } diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap index 163f7e1b17..4de60f90e7 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 103, + "featureLevel": 104, "creator": "zap", "keyValuePairs": [ { @@ -41,14 +41,16 @@ "code": 22, "profileId": 259, "label": "MA-rootdevice", - "name": "MA-rootdevice" + "name": "MA-rootdevice", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 22, "profileId": 259, "label": "MA-rootdevice", - "name": "MA-rootdevice" + "name": "MA-rootdevice", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -2670,14 +2672,16 @@ "code": 115, "profileId": 259, "label": "MA-laundry-washer", - "name": "MA-laundry-washer" + "name": "MA-laundry-washer", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 115, "profileId": 259, "label": "MA-laundry-washer", - "name": "MA-laundry-washer" + "name": "MA-laundry-washer", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -2690,6 +2694,138 @@ "deviceTypeCode": 115, "deviceTypeProfileId": 259, "clusters": [ + { + "name": "On/Off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "Off", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "On", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "Toggle", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "OnOff", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "6", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Descriptor", "code": 29, @@ -2934,22 +3070,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -3034,7 +3154,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3050,7 +3170,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3105,8 +3225,124 @@ "reportableChange": 0 }, { - "name": "EventList", - "code": 65530, + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Temperature Control", + "code": 86, + "mfgCode": null, + "define": "TEMPERATURE_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "SetTemperature", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "SelectedTemperatureLevel", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedTemperatureLevels", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, "mfgCode": null, "side": "server", "type": "array", @@ -3146,7 +3382,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3202,6 +3438,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "Resume", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, { "name": "OperationalCommandResponse", "code": 4, @@ -3244,6 +3488,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "CountdownTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "OperationalStateList", "code": 3, diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index 43e8de7b5f..1bc2e8726e 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -1845,7 +1845,7 @@ endpoint 1 { server cluster PressureMeasurement { ram attribute measuredValue default = 0xA; ram attribute minMeasuredValue default = 1; - ram attribute maxMeasuredValue default = 0xfffe; + ram attribute maxMeasuredValue default = 32767; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap index 3131dca9c5..f473e3dc7e 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap @@ -2721,7 +2721,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xfffe", + "defaultValue": "32767", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2830,4 +2830,4 @@ "parentEndpointIdentifier": null } ] -} \ No newline at end of file +} diff --git a/examples/chef/esp32/main/CMakeLists.txt b/examples/chef/esp32/main/CMakeLists.txt index 49f3fbabdc..5c8963f773 100644 --- a/examples/chef/esp32/main/CMakeLists.txt +++ b/examples/chef/esp32/main/CMakeLists.txt @@ -74,6 +74,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/../common/clusters/resource-monitoring/" "${CMAKE_SOURCE_DIR}/../common/clusters/switch/" "${CMAKE_SOURCE_DIR}/../common/clusters/target-navigator/" + "${CMAKE_SOURCE_DIR}/../common/clusters/temperature-control/" "${CMAKE_SOURCE_DIR}/../common/clusters/wake-on-lan/" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn index a65e6e7b6a..360c5fb349 100644 --- a/examples/chef/linux/BUILD.gn +++ b/examples/chef/linux/BUILD.gn @@ -65,6 +65,7 @@ executable("${sample_name}") { "${project_dir}/common/clusters/switch/SwitchEventHandler.cpp", "${project_dir}/common/clusters/switch/SwitchManager.cpp", "${project_dir}/common/clusters/target-navigator/TargetNavigatorManager.cpp", + "${project_dir}/common/clusters/temperature-control/static-supported-temperature-levels.cpp", "${project_dir}/common/clusters/wake-on-lan/WakeOnLanManager.cpp", "${project_dir}/common/stubs.cpp", "${project_dir}/linux/main.cpp", diff --git a/examples/chef/linux/with_pw_rpc.gni b/examples/chef/linux/with_pw_rpc.gni index 0f1ab1ea89..a67251431a 100644 --- a/examples/chef/linux/with_pw_rpc.gni +++ b/examples/chef/linux/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -39,4 +39,3 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true -chip_use_pw_logging = true diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt index 732398cc1b..32def1dbf4 100644 --- a/examples/chef/nrfconnect/CMakeLists.txt +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -101,6 +101,7 @@ target_sources(app PRIVATE ${CHEF}/common/clusters/resource-monitoring/chef-resource-monitoring-delegates.cpp ${CHEF}/common/clusters/switch/SwitchEventHandler.cpp ${CHEF}/common/clusters/switch/SwitchManager.cpp + ${CHEF}/common/clusters/temperature-control/static-supported-temperature-levels.cpp ${CHEF}/common/clusters/target-navigator/TargetNavigatorManager.cpp ${CHEF}/common/clusters/wake-on-lan/WakeOnLanManager.cpp ${CHEF}/common/stubs.cpp diff --git a/examples/chef/silabs/BUILD.gn b/examples/chef/silabs/BUILD.gn index f719245758..34dba76cc3 100644 --- a/examples/chef/silabs/BUILD.gn +++ b/examples/chef/silabs/BUILD.gn @@ -18,8 +18,8 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") diff --git a/examples/chef/silabs/build_for_wifi_args.gni b/examples/chef/silabs/build_for_wifi_args.gni index 9394037ba0..97180fa504 100644 --- a/examples/chef/silabs/build_for_wifi_args.gni +++ b/examples/chef/silabs/build_for_wifi_args.gni @@ -15,6 +15,6 @@ import("//build_overrides/chip.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") chip_enable_ota_requestor = true diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 82e9eedc46..91a65db789 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -55,6 +55,10 @@ bool Command::InitArguments(int argc, char ** argv) { optionalArgsCount++; } + else if (argvExtraArgsCount == 0) + { + mandatoryArgsCount++; + } else { mandatoryArgsCount++; diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp index 92861f7711..7c843cc900 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp @@ -25,13 +25,14 @@ #include #include -constexpr char kInteractiveModePrompt[] = ">>> "; -constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history"; -constexpr char kInteractiveModeStopCommand[] = "quit()"; -constexpr char kCategoryError[] = "Error"; -constexpr char kCategoryProgress[] = "Info"; -constexpr char kCategoryDetail[] = "Debug"; -constexpr char kCategoryAutomation[] = "Automation"; +constexpr char kInteractiveModePrompt[] = ">>> "; +constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history"; +constexpr char kInteractiveModeStopCommand[] = "quit()"; +constexpr char kInteractiveModeStopAlternateCommand[] = "quit"; +constexpr char kCategoryError[] = "Error"; +constexpr char kCategoryProgress[] = "Info"; +constexpr char kCategoryDetail[] = "Debug"; +constexpr char kCategoryAutomation[] = "Automation"; namespace { @@ -387,7 +388,7 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() bool InteractiveCommand::ParseCommand(char * command, int * status) { - if (strcmp(command, kInteractiveModeStopCommand) == 0) + if (strcmp(command, kInteractiveModeStopCommand) == 0 || strcmp(command, kInteractiveModeStopAlternateCommand) == 0) { // If scheduling the cleanup fails, there is not much we can do. // But if something went wrong while the application is leaving it could be because things have diff --git a/examples/chip-tool/include/CHIPProjectAppConfig.h b/examples/chip-tool/include/CHIPProjectAppConfig.h index 8c964bf502..d8ad2dfd43 100644 --- a/examples/chip-tool/include/CHIPProjectAppConfig.h +++ b/examples/chip-tool/include/CHIPProjectAppConfig.h @@ -54,8 +54,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 1 // Enable some test-only interaction model APIs. diff --git a/examples/common/pigweed/RpcService.cpp b/examples/common/pigweed/RpcService.cpp index 74d0b891e9..ee999c4b17 100644 --- a/examples/common/pigweed/RpcService.cpp +++ b/examples/common/pigweed/RpcService.cpp @@ -25,7 +25,6 @@ #include "pw_hdlc/decoder.h" #include "pw_hdlc/default_addresses.h" #include "pw_hdlc/rpc_channel.h" -#include "pw_log/log.h" #include "pw_rpc/channel.h" #include "pw_status/status.h" #include "pw_stream/sys_io_stream.h" @@ -96,20 +95,6 @@ void Start(void (*RegisterServices)(pw::rpc::Server &), ::chip::rpc::Mutex * uar PW_DASSERT(RegisterServices != nullptr); uart_mutex = uart_mutex_; - // Send log messages to HDLC address 1. This prevents logs from interfering - // with pw_rpc communications. - pw::log_basic::SetOutput([](std::string_view log) { - if (uart_mutex) - { - uart_mutex->Lock(); - } - pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), sysIoWriter); - if (uart_mutex) - { - uart_mutex->Unlock(); - } - }); - // Set up the server and start processing data. RegisterServices(server); diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 50f0b030f5..31ecd9df03 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -39,7 +39,7 @@ import argparse import sys from pathlib import Path -from typing import Any, Collection +from typing import Collection import pw_system.console from pw_hdlc import rpc @@ -52,7 +52,6 @@ from button_service import button_service_pb2 from descriptor_service import descriptor_service_pb2 from device_service import device_service_pb2 -from echo_service import echo_pb2 from fabric_admin_service import fabric_admin_service_pb2 from fabric_bridge_service import fabric_bridge_service_pb2 from lighting_service import lighting_service_pb2 @@ -72,13 +71,6 @@ def _parse_args(): type=int, default=115200, help='the baud rate to use') - parser.add_argument( - '-o', - '--output', - type=argparse.FileType('wb'), - default=sys.stdout.buffer, - help=('The file to which to write device output (HDLC channel 1); ' - 'provide - or omit for stdout.')) parser.add_argument( '-r', '--raw_serial', @@ -99,7 +91,7 @@ def _parse_args(): def show_console(device: str, baudrate: int, token_databases: Collection[Path], - socket_addr: str, output: Any, raw_serial: bool) -> int: + socket_addr: str, raw_serial: bool) -> int: # TODO: this shows a default console with little customization # Ideally we should at least customize the default messages @@ -114,7 +106,6 @@ def show_console(device: str, baudrate: int, device=device, baudrate=baudrate, socket_addr=socket_addr, - output=output, hdlc_encoding=not raw_serial, token_databases=token_databases, logfile="", @@ -122,14 +113,10 @@ def show_console(device: str, baudrate: int, channel_id=rpc.DEFAULT_CHANNEL_ID, # Defaults beyond the original console - proto_globs=[], ticks_per_second=None, host_logfile="", json_logfile="", rpc_logging=False, - # the pt-python based console seems to break on python 3.1 with - # "set_wakeup_fd only works in main thread of the main interpreter" - use_ipython=True, compiled_protos=[ actions_service_pb2, attributes_service_pb2, @@ -137,7 +124,6 @@ def show_console(device: str, baudrate: int, button_service_pb2, descriptor_service_pb2, device_service_pb2, - echo_pb2, fabric_admin_service_pb2, fabric_bridge_service_pb2, lighting_service_pb2, diff --git a/examples/common/pigweed/rpc_services/Attributes.h b/examples/common/pigweed/rpc_services/Attributes.h index e4ced64a51..99e348e3a2 100644 --- a/examples/common/pigweed/rpc_services/Attributes.h +++ b/examples/common/pigweed/rpc_services/Attributes.h @@ -23,23 +23,19 @@ #include #include +#include #include #include +#include +#include +#include #include #include -#include #include #include #include #include -#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE -#include -#include -#include -#include -#endif - namespace chip { namespace rpc { @@ -217,14 +213,13 @@ class Attributes : public pw_rpc::nanopb::Attributes::Service PW_TRY(ChipErrorToPwStatus(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outer))); PW_TRY(ChipErrorToPwStatus(attributeReports.Init(&writer, kReportContextTag))); -#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE // TODO: this assumes a singleton data model provider app::DataModel::Provider * provider = app::InteractionModelEngine::GetInstance()->GetDataModelProvider(); app::DataModel::ReadAttributeRequest request; request.path = path; request.operationFlags.Set(app::DataModel::OperationFlags::kInternal); - request.subjectDescriptor = subjectDescriptor; + request.subjectDescriptor = &subjectDescriptor; std::optional info = provider->GetClusterInfo(path); if (!info.has_value()) @@ -243,10 +238,6 @@ class Attributes : public pw_rpc::nanopb::Attributes::Service return ::pw::Status::Internal(); } -#else - PW_TRY(ChipErrorToPwStatus(app::ReadSingleClusterData(subjectDescriptor, false, path, attributeReports, nullptr))); -#endif - attributeReports.EndOfContainer(); PW_TRY(ChipErrorToPwStatus(writer.EndContainer(outer))); PW_TRY(ChipErrorToPwStatus(writer.Finalize())); diff --git a/examples/common/pigweed/system_rpc_server.cc b/examples/common/pigweed/system_rpc_server.cc index 098aa3b171..360bdef947 100644 --- a/examples/common/pigweed/system_rpc_server.cc +++ b/examples/common/pigweed/system_rpc_server.cc @@ -20,7 +20,6 @@ #include "pw_hdlc/decoder.h" #include "pw_hdlc/default_addresses.h" #include "pw_hdlc/rpc_channel.h" -#include "pw_log/log.h" #include "pw_rpc_system_server/rpc_server.h" #include "pw_stream/sys_io_stream.h" @@ -40,12 +39,7 @@ rpc::Server server(channels); } // namespace -void Init() -{ - // Send log messages to HDLC address 1. This prevents logs from interfering - // with pw_rpc communications. - pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), writer); }); -} +void Init() {} rpc::Server & Server() { diff --git a/examples/contact-sensor-app/nxp/README.md b/examples/contact-sensor-app/nxp/README.md index 803f067ce3..908da90cfc 100644 --- a/examples/contact-sensor-app/nxp/README.md +++ b/examples/contact-sensor-app/nxp/README.md @@ -133,7 +133,7 @@ corresponding to data model target. ### Manufacturing data -Use `chip_with_factory_data=1` in the gn build command to enable factory data. +Use `nxp_use_factory_data=true` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see [Guide for writing manufacturing data on NXP devices](../../../docs/platforms/nxp/nxp_manufacturing_flow.md). @@ -181,9 +181,9 @@ will be very low. In order to build with low power support, the following gn args must be used: ``` -chip_with_low_power = 1 +nxp_use_low_power = true chip_openthread_ftd = false -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_logging = false ``` diff --git a/examples/contact-sensor-app/nxp/common/AppTask.cpp b/examples/contact-sensor-app/nxp/common/AppTask.cpp index 7539bc61e0..2b102adc1b 100644 --- a/examples/contact-sensor-app/nxp/common/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/common/AppTask.cpp @@ -18,10 +18,6 @@ #include "AppTask.h" -#if CONFIG_LOW_POWER -#include "PWR_Interface.h" -#endif - #include #include @@ -36,18 +32,6 @@ void ContactSensorApp::AppTask::PreInitMatterStack() ChipLogProgress(DeviceLayer, "Welcome to NXP Contact Sensor Demo App"); } -#if CONFIG_LOW_POWER -void ContactSensorApp::AppTask::AppMatter_DisallowDeviceToSleep() -{ - PWR_DisallowDeviceToSleep(); -} - -void ContactSensorApp::AppTask::AppMatter_AllowDeviceToSleep() -{ - PWR_AllowDeviceToSleep(); -} -#endif - ContactSensorApp::AppTask & ContactSensorApp::AppTask::GetDefaultInstance() { static ContactSensorApp::AppTask sAppTask; diff --git a/examples/contact-sensor-app/nxp/common/include/AppTask.h b/examples/contact-sensor-app/nxp/common/include/AppTask.h index 407572aad2..7a4a9a6161 100644 --- a/examples/contact-sensor-app/nxp/common/include/AppTask.h +++ b/examples/contact-sensor-app/nxp/common/include/AppTask.h @@ -34,10 +34,6 @@ class AppTask : public chip::NXP::App::AppTaskFreeRTOS // AppTaskFreeRTOS virtual methods void PreInitMatterStack() override; -#if CONFIG_LOW_POWER - void AppMatter_DisallowDeviceToSleep() override; - void AppMatter_AllowDeviceToSleep() override; -#endif // This returns an instance of this class. static AppTask & GetDefaultInstance(); diff --git a/examples/contact-sensor-app/nxp/k32w0/BUILD.gn b/examples/contact-sensor-app/nxp/k32w0/BUILD.gn index f032603d00..a691fc8713 100644 --- a/examples/contact-sensor-app/nxp/k32w0/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w0/BUILD.gn @@ -100,7 +100,7 @@ k32w0_executable("contact_sensor_app") { "main/main.cpp", ] - if (chip_with_factory_data == 1 && use_custom_factory_provider == 1) { + if (nxp_use_factory_data && use_custom_factory_provider == 1) { sources += [ "${k32w0_platform_dir}/common/CustomFactoryDataProvider.cpp", "${k32w0_platform_dir}/common/CustomFactoryDataProvider.h", diff --git a/examples/contact-sensor-app/nxp/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w0/README.md index bc39009afc..c390bc3ab5 100644 --- a/examples/contact-sensor-app/nxp/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w0/README.md @@ -243,8 +243,8 @@ Also, in case the OM15082 Expansion Board is not attached to the DK6 board, the build argument (chip_with_OM15082) inside the gn build instruction should be set to zero. The argument chip_with_OM15082 is set to zero by default. -In case that Openthread CLI is needed, chip_with_ot_cli build argument must be -set to 1. +In case that Openthread CLI is needed, `nxp_enable_ot_cli` build argument must +be set to `true`. In case the board doesn't have 32KHz crystal fitted, one can use the 32KHz free running oscillator as a clock source. In this case one must set the use_fro_32k @@ -371,10 +371,10 @@ CHIPProjectConfig.h. Regarding factory data provider, there are two options: - use the default factory data provider: `FactoryDataProviderImpl` by setting - `chip_with_factory_data=1` in the gn build command. + `nxp_use_factory_data=true` in the gn build command. - use a custom factory data provider: please see [Guide for implementing a custom factory data provider](../../../platform/nxp/k32w0/doc/CustomFactoryDataProvider.md). - This can be enabled when `chip_with_factory_data=1` by setting + This can be enabled when `nxp_use_factory_data=true` by setting `use_custom_factory_provider=1` in the gn build command. ## Flashing and debugging @@ -697,9 +697,9 @@ factory data TLV value. A user can select which default processors to enable: -- `chip_enable_ota_firmware_processor=1` to enable default firmware (app/SSBL) - update processor (enabled by default). -- `chip_enable_ota_factory_data_processor=1` to enable default factory data +- `nxp_enable_ota_firmware_processor=true` to enable default firmware + (app/SSBL) update processor (enabled by default). +- `nxp_enable_ota_factory_data_processor=true` to enable default factory data update processor (disabled by default). The address for storing the custom OTA entry can also be specified: @@ -799,9 +799,9 @@ The example also offers the possibility to run in low power mode. This means that the board will go in a deep power down mode most of the time and the power consumption will be very low. -In order to build with low power support, the _chip_with_low_power=1_ must be +In order to build with low power support, the _nxp_use_low_power=true_ must be provided to the build system. In this case, please note that the GN build -arguments _chip_with_OM15082_ and _chip_with_ot_cli_ must be set to 0 and +arguments _chip_with_OM15082_ and _nxp_enable_ot_cli_ must be set to false and _chip_logging_ must be set to false to disable logging. In order to maintain a low power consumption, the LEDs showing the state of the diff --git a/examples/contact-sensor-app/nxp/k32w0/args.gni b/examples/contact-sensor-app/nxp/k32w0/args.gni index f4b68ae740..1f2e2ef966 100644 --- a/examples/contact-sensor-app/nxp/k32w0/args.gni +++ b/examples/contact-sensor-app/nxp/k32w0/args.gni @@ -35,6 +35,6 @@ is_debug = false chip_crypto = "platform" chip_crypto_flavor = "NXP-Ultrafast-P256" -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_with_OM15082 = 1 chip_pw_tokenizer_logging = true diff --git a/examples/contact-sensor-app/nxp/k32w0/include/FreeRTOSConfig.h b/examples/contact-sensor-app/nxp/k32w0/include/FreeRTOSConfig.h index 5694c591e5..78fed95d41 100644 --- a/examples/contact-sensor-app/nxp/k32w0/include/FreeRTOSConfig.h +++ b/examples/contact-sensor-app/nxp/k32w0/include/FreeRTOSConfig.h @@ -41,7 +41,7 @@ #define configUSE_PREEMPTION 1 -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) #define configUSE_TICKLESS_IDLE 1 #else #define configUSE_TICKLESS_IDLE 0 diff --git a/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp index 36cf190adf..40ffd9d8bf 100644 --- a/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w0/main/AppTask.cpp @@ -65,7 +65,7 @@ TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer. static QueueHandle_t sAppEventQueue; -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) static LEDWidget sStatusLED; static LEDWidget sContactSensorLED; #endif @@ -225,7 +225,7 @@ CHIP_ERROR AppTask::Init() AppTask::PrintOnboardingInfo(); /* HW init leds */ -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) LED_Init(); /* start with all LEDS turnedd off */ @@ -365,7 +365,7 @@ void AppTask::AppTaskMain(void * pvParameter) { TickType_t xTicksToWait = pdMS_TO_TICKS(10); -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) xTicksToWait = portMAX_DELAY; #endif @@ -403,7 +403,7 @@ void AppTask::AppTaskMain(void * pvParameter) // // Otherwise, blink the LED ON for a very short time. -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) if (sAppTask.mFunction != Function::kFactoryReset && sAppTask.mFunction != Function::kIdentify) { if (sIsThreadProvisioned) @@ -580,7 +580,7 @@ void AppTask::ResetActionEventHandler(void * aGenericEvent) sAppTask.CancelTimer(); sAppTask.mFunction = Function::kNoneSelected; -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) /* restore initial state for the LED indicating contact state */ if (!ContactSensorMgr().IsContactClosed()) { @@ -608,7 +608,7 @@ void AppTask::ResetActionEventHandler(void * aGenericEvent) sAppTask.mFunction = Function::kFactoryReset; /* LEDs will start blinking to signal that a Factory Reset was scheduled */ -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) sStatusLED.Set(false); sContactSensorLED.Set(false); @@ -706,7 +706,7 @@ void AppTask::BleStartAdvertising(intptr_t arg) if (ConnectivityMgr().IsBLEAdvertisingEnabled()) { ConnectivityMgr().SetBLEAdvertisingEnabled(false); -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) sStatusLED.Set(false); #endif K32W_LOG("Stopped BLE Advertising!"); @@ -717,7 +717,7 @@ void AppTask::BleStartAdvertising(intptr_t arg) if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) { -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) sStatusLED.Set(true); #endif K32W_LOG("Started BLE Advertising!"); @@ -845,14 +845,14 @@ void AppTask::OnStateChanged(ContactSensorManager::State aState) if (ContactSensorManager::State::kContactClosed == aState) { K32W_LOG("Contact state changed to closed.") -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) sContactSensorLED.Set(true); #endif } else if (ContactSensorManager::State::kContactOpened == aState) { K32W_LOG("Contact state changed to opened.") -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) sContactSensorLED.Set(false); #endif } @@ -876,7 +876,7 @@ void AppTask::OnIdentifyStart(Identify * identify) } K32W_LOG("Identify process has started. Status LED should blink every 0.5 seconds."); sAppTask.mFunction = Function::kIdentify; -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) sStatusLED.Set(false); sStatusLED.Blink(500); #endif @@ -926,7 +926,7 @@ void AppTask::PostEvent(const AppEvent * aEvent) void AppTask::DispatchEvent(AppEvent * aEvent) { -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) /* specific processing for events sent from App_PostCallbackMessage (see main.cpp) */ if (aEvent->Type == AppEvent::kEventType_Lp) { @@ -974,7 +974,7 @@ void AppTask::UpdateDeviceStateInternal(intptr_t arg) /* get onoff attribute value */ (void) app::Clusters::BooleanState::Attributes::StateValue::Get(1, &stateValueAttrValue); -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) +#if !defined(nxp_use_low_power) || (nxp_use_low_power == 0) /* set the device state */ sContactSensorLED.Set(stateValueAttrValue); #endif diff --git a/examples/contact-sensor-app/nxp/k32w0/main/include/AppEvent.h b/examples/contact-sensor-app/nxp/k32w0/main/include/AppEvent.h index b8ae7e7254..ce1e4fbbc7 100644 --- a/examples/contact-sensor-app/nxp/k32w0/main/include/AppEvent.h +++ b/examples/contact-sensor-app/nxp/k32w0/main/include/AppEvent.h @@ -29,7 +29,7 @@ struct AppEvent kTimer, kContact, kInstall, -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) kEventType_Lp, #endif kOTAResume, @@ -56,7 +56,7 @@ struct AppEvent EventHandler Handler; -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) void * param; #endif }; diff --git a/examples/contact-sensor-app/nxp/k32w0/main/main.cpp b/examples/contact-sensor-app/nxp/k32w0/main/main.cpp index 9517d7e2cf..6d6c3af043 100644 --- a/examples/contact-sensor-app/nxp/k32w0/main/main.cpp +++ b/examples/contact-sensor-app/nxp/k32w0/main/main.cpp @@ -35,7 +35,7 @@ #include #endif -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) #include "fsl_gpio.h" #include "fsl_iocon.h" #include "gpio_pins.h" @@ -86,7 +86,7 @@ void APP_SetMaxTxPower() #endif /* low power requirements */ -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) extern "C" void setThreadInitialized(bool isInitialized); extern "C" bool isThreadInitialized(); #endif @@ -160,7 +160,7 @@ extern "C" void main_task(void const * argument) goto exit; } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) setThreadInitialized(TRUE); #endif @@ -206,7 +206,7 @@ extern "C" void main_task(void const * argument) extern "C" void otSysEventSignalPending(void) { -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) /* make sure that 15.4 radio is initialized before waking up the Thread task */ if (isThreadInitialized()) #endif @@ -216,7 +216,7 @@ extern "C" void otSysEventSignalPending(void) } } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) extern "C" void vOptimizeConsumption(void) { /* BUTTON2 change contact, BUTTON4 start adv/factoryreset */ diff --git a/examples/contact-sensor-app/nxp/k32w1/BUILD.gn b/examples/contact-sensor-app/nxp/k32w1/BUILD.gn index 1b57e5f3cf..c96f9676b2 100644 --- a/examples/contact-sensor-app/nxp/k32w1/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w1/BUILD.gn @@ -87,7 +87,7 @@ mcxw71_k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", ] - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { include_dirs += [ "${example_platform_dir}/board" ] sources += [ "${example_platform_dir}/board/peripherals.c", @@ -117,7 +117,7 @@ mcxw71_k32w1_executable("contact_sensor_app") { defines += [ "CONFIG_DIAG_LOGS_DEMO=1" ] } - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { defines += [ "CONFIG_LOW_POWER=1" ] } else { defines += [ @@ -158,11 +158,11 @@ mcxw71_k32w1_executable("contact_sensor_app") { "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", ] - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { sources += [ "${common_example_dir}/low_power/source/LowPower.cpp" ] } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ] deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] @@ -216,7 +216,7 @@ mcxw71_k32w1_executable("contact_sensor_app") { "../common/main.cpp", ] - if (chip_with_low_power == 0) { + if (!nxp_use_low_power) { sources += [ "${common_example_dir}/ui_feedback/source/LedManager.cpp", "${example_platform_dir}/util/LedOnOff.cpp", @@ -263,7 +263,7 @@ mcxw71_k32w1_executable("contact_sensor_app") { "-T" + rebase_path(ldscript, root_build_dir), ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] } diff --git a/examples/contact-sensor-app/nxp/k32w1/args.gni b/examples/contact-sensor-app/nxp/k32w1/args.gni index e5654bdbc7..363718f1a8 100644 --- a/examples/contact-sensor-app/nxp/k32w1/args.gni +++ b/examples/contact-sensor-app/nxp/k32w1/args.gni @@ -39,6 +39,6 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = false -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_with_diag_logs_demo = true diff --git a/examples/contact-sensor-app/nxp/mcxw71/BUILD.gn b/examples/contact-sensor-app/nxp/mcxw71/BUILD.gn index 8bba2393f8..48719dbc9b 100644 --- a/examples/contact-sensor-app/nxp/mcxw71/BUILD.gn +++ b/examples/contact-sensor-app/nxp/mcxw71/BUILD.gn @@ -86,7 +86,7 @@ mcxw71_k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", ] - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { include_dirs += [ "${example_platform_dir}/board" ] sources += [ "${example_platform_dir}/board/peripherals.c", @@ -116,7 +116,7 @@ mcxw71_k32w1_executable("contact_sensor_app") { defines += [ "CONFIG_DIAG_LOGS_DEMO=1" ] } - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { defines += [ "CONFIG_LOW_POWER=1" ] } else { defines += [ @@ -157,11 +157,11 @@ mcxw71_k32w1_executable("contact_sensor_app") { "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", ] - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { sources += [ "${common_example_dir}/low_power/source/LowPower.cpp" ] } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ] deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] @@ -215,7 +215,7 @@ mcxw71_k32w1_executable("contact_sensor_app") { "../common/main.cpp", ] - if (chip_with_low_power == 0) { + if (!nxp_use_low_power) { sources += [ "${common_example_dir}/ui_feedback/source/LedManager.cpp", "${example_platform_dir}/util/LedOnOff.cpp", @@ -262,7 +262,7 @@ mcxw71_k32w1_executable("contact_sensor_app") { "-T" + rebase_path(ldscript, root_build_dir), ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] } diff --git a/examples/contact-sensor-app/nxp/mcxw71/args.gni b/examples/contact-sensor-app/nxp/mcxw71/args.gni index 6e6015933d..bf06f4e494 100644 --- a/examples/contact-sensor-app/nxp/mcxw71/args.gni +++ b/examples/contact-sensor-app/nxp/mcxw71/args.gni @@ -37,6 +37,6 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = false -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_with_diag_logs_demo = true diff --git a/examples/darwin-framework-tool/BUILD.gn b/examples/darwin-framework-tool/BUILD.gn index 0d1e142f10..fbe1c4d6f8 100644 --- a/examples/darwin-framework-tool/BUILD.gn +++ b/examples/darwin-framework-tool/BUILD.gn @@ -45,7 +45,7 @@ declare_args() { generate_compilation_database = false # Enable automatic leak checks before the application exits - enable_leak_checking = false + enable_leak_checking = !is_asan && target_os == "mac" } sdk = "macosx" @@ -53,7 +53,9 @@ sdk_build_dir_suffix = "" if (getenv("SDKROOT") != "") { sdk = getenv("SDKROOT") sdk_root_parts = string_split(getenv("SDKROOT"), ".") - sdk_build_dir_suffix = "-${sdk_root_parts[0]}" + if (sdk_root_parts[0] != "macosx") { + sdk_build_dir_suffix = "-${sdk_root_parts[0]}" + } } output_sdk_type = "Debug${sdk_build_dir_suffix}" @@ -134,7 +136,7 @@ action("build-darwin-framework") { "${root_out_dir}/macos_framework_output/Build", ] - if (sdk == "macosx") { + if (sdk == "macosx" || sdk_root_parts[0] == "macosx") { outputs += [ "${root_out_dir}/macos_framework_output/Build/Intermediates.noindex/Matter.build/${output_sdk_type}/Matter.build/out/lib/libCHIP.a" ] } } @@ -194,6 +196,8 @@ executable("darwin-framework-tool") { "commands/common/CertificateIssuer.mm", "commands/common/ControllerStorage.h", "commands/common/ControllerStorage.mm", + "commands/common/DeviceDelegate.h", + "commands/common/DeviceDelegate.mm", "commands/common/MTRDevice_Externs.h", "commands/common/MTRError.mm", "commands/common/MTRError_Utils.h", @@ -283,11 +287,12 @@ executable("darwin-framework-tool") { "Foundation.framework", "CoreBluetooth.framework", "Network.framework", + "IOKit.framework", ] # Other SDKs are linked statically to Matter.framework but the macosx SDK is linked dynamically but needs some symbols that are # not exposed by the dylib. - if (sdk == "macosx") { + if (sdk == "macosx" || sdk_root_parts[0] == "macosx") { libs = [ "${root_out_dir}/macos_framework_output/Build/Intermediates.noindex/Matter.build/${output_sdk_type}/Matter.build/out/lib/libCHIP.a" ] } diff --git a/examples/darwin-framework-tool/commands/clusters/ClusterCommandBridge.h b/examples/darwin-framework-tool/commands/clusters/ClusterCommandBridge.h index 50b9cfed5d..c94d666de5 100644 --- a/examples/darwin-framework-tool/commands/clusters/ClusterCommandBridge.h +++ b/examples/darwin-framework-tool/commands/clusters/ClusterCommandBridge.h @@ -45,6 +45,8 @@ class ClusterCommand : public ModelCommand { ~ClusterCommand() {} + using ModelCommand::SendCommand; + CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId) override { id commandFields; diff --git a/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.h b/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.h index 8e5bb8f984..6f29bf165d 100644 --- a/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.h +++ b/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.h @@ -52,6 +52,10 @@ class ModelCommand : public CHIPCommandBridge } virtual CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endPointId) = 0; + virtual CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endPointId) { return CHIP_ERROR_NOT_IMPLEMENTED; } + +protected: + chip::Optional mUseMTRDevice; private: chip::NodeId mNodeId; diff --git a/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.mm b/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.mm index 47a29f80c3..c430364f53 100644 --- a/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.mm +++ b/examples/darwin-framework-tool/commands/clusters/ModelCommandBridge.mm @@ -26,10 +26,18 @@ CHIP_ERROR ModelCommand::RunCommand() { ChipLogProgress(chipTool, "Sending command to node 0x" ChipLogFormatX64, ChipLogValueX64(mNodeId)); - auto * device = BaseDeviceWithNodeId(mNodeId); - VerifyOrReturnError(device != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR err = SendCommand(device, mEndPointId); + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mUseMTRDevice.ValueOr(false)) { + auto * device = DeviceWithNodeId(mNodeId); + VerifyOrReturnError(device != nil, CHIP_ERROR_INCORRECT_STATE); + err = SendCommand(device, mEndPointId); + } else { + auto * device = BaseDeviceWithNodeId(mNodeId); + VerifyOrReturnError(device != nil, CHIP_ERROR_INCORRECT_STATE); + err = SendCommand(device, mEndPointId); + } if (err != CHIP_NO_ERROR) { ChipLogError(chipTool, "Error: %s", chip::ErrorStr(err)); diff --git a/examples/darwin-framework-tool/commands/clusters/ReportCommandBridge.h b/examples/darwin-framework-tool/commands/clusters/ReportCommandBridge.h index 1a2612b7e3..ba3428341e 100644 --- a/examples/darwin-framework-tool/commands/clusters/ReportCommandBridge.h +++ b/examples/darwin-framework-tool/commands/clusters/ReportCommandBridge.h @@ -28,7 +28,7 @@ class ReadAttribute : public ModelCommand { AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId); AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId); AddArgument("fabric-filtered", 0, 1, &mFabricFiltered); - ModelCommand::AddArguments(); + AddCommonByIdArguments(); } ReadAttribute(chip::ClusterId clusterId) @@ -37,7 +37,7 @@ class ReadAttribute : public ModelCommand { { AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId); AddArgument("fabric-filtered", 0, 1, &mFabricFiltered); - ModelCommand::AddArguments(); + AddCommonByIdArguments(); } ReadAttribute(const char * _Nonnull attributeName) @@ -83,7 +83,44 @@ class ReadAttribute : public ModelCommand { return CHIP_NO_ERROR; } + CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override + { + MTRReadParams * params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + + __auto_type * endpoint = @(endpointId); + __auto_type * cluster = @(mClusterId); + __auto_type * attribute = @(mAttributeId); + __auto_type values = [device readAttributeWithEndpointID:endpoint + clusterID:cluster + attributeID:attribute + params:params]; + + NSError * error = nil; + if (nil == values) { + __auto_type * userInfo = @ { @"reason" : @"No value available." }; + error = [NSError errorWithDomain:@"Error" code:0 userInfo:userInfo]; + LogNSError("Error reading attribute", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(endpoint, cluster, attribute, error); + } else { + NSLog(@"cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u: %@", mClusterId, mAttributeId, endpointId, values); + RemoteDataModelLogger::LogAttributeAsJSON(endpoint, cluster, attribute, values); + } + + SetCommandExitStatus(error); + return CHIP_NO_ERROR; + } + protected: + void AddCommonByIdArguments() + { + AddArgument("use-mtr-device", 0, 1, &mUseMTRDevice, + "Use MTRDevice instead of MTRBaseDevice to send this command. Default is false."); + ModelCommand::AddArguments(); + } + chip::Optional mFabricFiltered; private: diff --git a/examples/darwin-framework-tool/commands/clusters/WriteAttributeCommandBridge.h b/examples/darwin-framework-tool/commands/clusters/WriteAttributeCommandBridge.h index f274ea21aa..0a779740b9 100644 --- a/examples/darwin-framework-tool/commands/clusters/WriteAttributeCommandBridge.h +++ b/examples/darwin-framework-tool/commands/clusters/WriteAttributeCommandBridge.h @@ -25,6 +25,8 @@ #import "MTRError_Utils.h" #import +constexpr uint32_t kDefaultExpectedValueInterval = 60000; + class WriteAttribute : public ModelCommand { public: WriteAttribute() @@ -33,7 +35,7 @@ class WriteAttribute : public ModelCommand { AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId); AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId); AddArgument("attribute-value", &mAttributeValue); - AddArguments(); + AddCommonByIdArguments(); } WriteAttribute(chip::ClusterId clusterId) @@ -42,7 +44,7 @@ class WriteAttribute : public ModelCommand { { AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId); AddArgument("attribute-value", &mAttributeValue); - AddArguments(); + AddCommonByIdArguments(); } ~WriteAttribute() {} @@ -54,6 +56,13 @@ class WriteAttribute : public ModelCommand { return WriteAttribute::SendCommand(device, endpointId, mClusterId, mAttributeId, value); } + CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId) override + { + id value; + ReturnErrorOnFailure(GetValue(&value)); + return WriteAttribute::SendCommand(device, endpointId, mClusterId, mAttributeId, value); + } + CHIP_ERROR SendCommand(MTRBaseDevice * _Nonnull device, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, id _Nonnull value) { @@ -87,6 +96,28 @@ class WriteAttribute : public ModelCommand { return CHIP_NO_ERROR; } + CHIP_ERROR SendCommand(MTRDevice * _Nonnull device, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::AttributeId attributeId, id _Nonnull value) + { + __auto_type * endpoint = @(endpointId); + __auto_type * cluster = @(mClusterId); + __auto_type * attribute = @(mAttributeId); + __auto_type * expectedValueInterval = @(mExpectedValueInterval.ValueOr(kDefaultExpectedValueInterval)); + __auto_type * timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() + ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] + : nil; + + [device writeAttributeWithEndpointID:endpoint + clusterID:cluster + attributeID:attribute + value:value + expectedValueInterval:expectedValueInterval + timedWriteTimeout:timedWriteTimeout]; + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + protected: WriteAttribute(const char * _Nonnull attributeName) : ModelCommand("write") @@ -95,6 +126,14 @@ class WriteAttribute : public ModelCommand { // Subclasses are responsible for calling AddArguments. } + void AddCommonByIdArguments() + { + AddArgument("use-mtr-device", 0, 1, &mUseMTRDevice, + "Use MTRDevice instead of MTRBaseDevice to send this command. Default is false."); + AddArgument("expectedValueInterval", 0, UINT32_MAX, &mExpectedValueInterval, "When the write is issued using an MTRDevice (via –use-mtr-device), specify the maximum interval (in milliseconds) during which reads of the attribute will return the expected value. The default is 60000 milliseconds (60 seconds)."); + AddArguments(); + } + void AddArguments() { AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs, @@ -104,6 +143,7 @@ class WriteAttribute : public ModelCommand { } chip::Optional mTimedInteractionTimeoutMs; + chip::Optional mExpectedValueInterval; chip::Optional mDataVersion; private: diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h index f58251bff4..7f9f3f9b6e 100644 --- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h +++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h @@ -30,6 +30,7 @@ inline constexpr char kIdentityAlpha[] = "alpha"; inline constexpr char kIdentityBeta[] = "beta"; inline constexpr char kIdentityGamma[] = "gamma"; +inline constexpr char kControllerIdPrefix[] = "8DCADB14-AF1F-45D0-B084-00000000000"; class CHIPCommandBridge : public Command { public: @@ -42,7 +43,7 @@ class CHIPCommandBridge : public Command { "commissioner-name. Interactive mode will only set a single commissioner on the inital command. " "The commissioner node ID will be persisted until a different one is specified."); AddArgument("commissioner-shared-storage", 0, 1, &mCommissionerSharedStorage, - "Use a shared storage instance instead of individual storage for each commissioner. Default is true."); + "Use a shared storage instance instead of individual storage for each commissioner. Default is false."); AddArgument("paa-trust-store-path", &mPaaTrustStorePath, "Path to directory holding PAA certificate information. Can be absolute or relative to the current working " "directory."); @@ -69,6 +70,8 @@ class CHIPCommandBridge : public Command { static OTAProviderDelegate * mOTADelegate; + static NSNumber * GetCommissionerFabricId(const char * identity); + protected: // Will be called in a setting in which it's safe to touch the CHIP // stack. The rules for Run() are as follows: @@ -97,6 +100,10 @@ class CHIPCommandBridge : public Command { // Will utilize an existing PASE connection if the device is being commissioned. MTRBaseDevice * BaseDeviceWithNodeId(chip::NodeId nodeId); + // Returns the MTRDevice for the specified node ID. + // Will utilize an existing PASE connection if the device is being commissioned. + MTRDevice * DeviceWithNodeId(chip::NodeId nodeId); + // Will log the given string and given error (as progress if success, error // if failure). void LogNSError(const char * logString, NSError * error); @@ -121,6 +128,10 @@ class CHIPCommandBridge : public Command { void RestartCommissioners(); + void SuspendOrResumeCommissioners(); + + MTRDevice * GetLastUsedDevice(); + private: CHIP_ERROR InitializeCommissioner( std::string key, chip::FabricId fabricId, const chip::Credentials::AttestationTrustStore * trustStore); diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm index 724a9a20c3..69071d4c42 100644 --- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm +++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm @@ -28,12 +28,16 @@ #import "CHIPCommandStorageDelegate.h" #import "CertificateIssuer.h" #import "ControllerStorage.h" +#import "DeviceDelegate.h" #include "MTRError_Utils.h" #include #include static CHIPToolPersistentStorageDelegate * storage = nil; +static MTRDevice * sLastUsedDevice = nil; +static DeviceDelegate * sDeviceDelegate = nil; +static dispatch_queue_t sDeviceDelegateDispatchQueue = nil; std::set CHIPCommandBridge::sDeferredCleanups; std::map CHIPCommandBridge::mControllers; dispatch_queue_t CHIPCommandBridge::mOTAProviderCallbackQueue; @@ -139,7 +143,7 @@ productAttestationAuthorityCertificates = nil; } - sUseSharedStorage = mCommissionerSharedStorage.ValueOr(true); + sUseSharedStorage = mCommissionerSharedStorage.ValueOr(false); if (sUseSharedStorage) { return SetUpStackWithSharedStorage(productAttestationAuthorityCertificates); } @@ -154,10 +158,10 @@ constexpr const char * identities[] = { kIdentityAlpha, kIdentityBeta, kIdentityGamma }; std::string commissionerName = mCommissionerName.HasValue() ? mCommissionerName.Value() : kIdentityAlpha; for (size_t i = 0; i < ArraySize(identities); ++i) { - __auto_type * uuidString = [NSString stringWithFormat:@"%@%@", @"8DCADB14-AF1F-45D0-B084-00000000000", @(i)]; + __auto_type * fabricId = GetCommissionerFabricId(identities[i]); + __auto_type * uuidString = [NSString stringWithFormat:@"%@%@", @(kControllerIdPrefix), fabricId]; __auto_type * controllerId = [[NSUUID alloc] initWithUUIDString:uuidString]; __auto_type * vendorId = @(mCommissionerVendorId.ValueOr(chip::VendorId::TestVendor1)); - __auto_type * fabricId = @(i + 1); __auto_type * nodeId = @(chip::kTestControllerNodeId); if (commissionerName.compare(identities[i]) == 0 && mCommissionerNodeId.HasValue()) { @@ -185,6 +189,10 @@ intermediateCertificate:nil rootCertificate:certificateIssuer.rootCertificate]; [params setOperationalCertificateIssuer:certificateIssuer queue:controllerStorageQueue]; + + __auto_type * otaDelegateQueue = dispatch_queue_create("com.chip.ota", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + [params setOTAProviderDelegate:mOTADelegate queue:otaDelegateQueue]; + params.productAttestationAuthorityCertificates = productAttestationAuthorityCertificates; __auto_type * controller = [[MTRDeviceController alloc] initWithParameters:params error:&error]; @@ -214,7 +222,7 @@ constexpr const char * identities[] = { kIdentityAlpha, kIdentityBeta, kIdentityGamma }; std::string commissionerName = mCommissionerName.HasValue() ? mCommissionerName.Value() : kIdentityAlpha; for (size_t i = 0; i < ArraySize(identities); ++i) { - __auto_type * fabricId = @(i + 1); + __auto_type * fabricId = GetCommissionerFabricId(identities[i]); __auto_type * params = [[MTRDeviceControllerStartupParams alloc] initWithIPK:certificateIssuer.ipk fabricID:fabricId nocSigner:certificateIssuer.signingKey]; @@ -260,14 +268,19 @@ NSNumber * CHIPCommandBridge::CurrentCommissionerFabricId() { - if (mCurrentIdentity.compare(kIdentityAlpha) == 0) { + return GetCommissionerFabricId(mCurrentIdentity.c_str()); +} + +NSNumber * CHIPCommandBridge::GetCommissionerFabricId(const char * identity) +{ + if (strcmp(identity, kIdentityAlpha) == 0) { return @(1); - } else if (mCurrentIdentity.compare(kIdentityBeta) == 0) { + } else if (strcmp(identity, kIdentityBeta) == 0) { return @(2); - } else if (mCurrentIdentity.compare(kIdentityGamma) == 0) { + } else if (strcmp(identity, kIdentityGamma) == 0) { return @(3); } else { - ChipLogError(chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s]", mCurrentIdentity.c_str(), kIdentityAlpha, + ChipLogError(chipTool, "Unknown commissioner name: %s. Supported names are [%s, %s, %s]", identity, kIdentityAlpha, kIdentityBeta, kIdentityGamma); chipDie(); } @@ -285,6 +298,25 @@ ?: [MTRBaseDevice deviceWithNodeID:@(nodeId) controller:controller]; } +MTRDevice * CHIPCommandBridge::DeviceWithNodeId(chip::NodeId nodeId) +{ + __auto_type * controller = CurrentCommissioner(); + VerifyOrReturnValue(nil != controller, nil); + + __auto_type * device = [MTRDevice deviceWithNodeID:@(nodeId) controller:controller]; + VerifyOrReturnValue(nil != device, nil); + + // The device delegate is initialized only once, when the first MTRDevice is created. + if (sDeviceDelegate == nil) { + sDeviceDelegate = [[DeviceDelegate alloc] init]; + sDeviceDelegateDispatchQueue = dispatch_queue_create("com.chip.devicedelegate", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + } + [device addDelegate:sDeviceDelegate queue:sDeviceDelegateDispatchQueue]; + + sLastUsedDevice = device; + return device; +} + void CHIPCommandBridge::StopCommissioners() { for (auto & pair : mControllers) { @@ -328,6 +360,21 @@ [[MTRDeviceControllerFactory sharedInstance] stopControllerFactory]; } +void CHIPCommandBridge::SuspendOrResumeCommissioners() +{ + for (auto & pair : mControllers) { + __auto_type * commissioner = pair.second; + if (commissioner.running) { + commissioner.suspended ? [commissioner resume] : [commissioner suspend]; + } + } +} + +MTRDevice * CHIPCommandBridge::GetLastUsedDevice() +{ + return sLastUsedDevice; +} + CHIP_ERROR CHIPCommandBridge::StartWaiting(chip::System::Clock::Timeout duration) { auto waitingUntil = std::chrono::system_clock::now() + std::chrono::duration_cast(duration); diff --git a/examples/darwin-framework-tool/commands/common/CertificateIssuer.mm b/examples/darwin-framework-tool/commands/common/CertificateIssuer.mm index bd12878c6a..c86a41490b 100644 --- a/examples/darwin-framework-tool/commands/common/CertificateIssuer.mm +++ b/examples/darwin-framework-tool/commands/common/CertificateIssuer.mm @@ -21,6 +21,8 @@ #include +constexpr const uint32_t kIssuerId = 12345678; + @interface CertificateIssuer () - (MTRCertificateDERBytes _Nullable)issueOperationalCertificateForNodeID:(NSNumber *)nodeID fabricID:(NSNumber *)fabricID @@ -67,7 +69,7 @@ - (void)startWithStorage:(id)storage return; } - __auto_type * rootCertificate = [MTRCertificates createRootCertificate:signingKey issuerID:nil fabricID:nil error:error]; + __auto_type * rootCertificate = [MTRCertificates createRootCertificate:signingKey issuerID:@(kIssuerId) fabricID:nil error:error]; if (nil == rootCertificate) { *error = [NSError errorWithDomain:@"Error" code:0 userInfo:@{ @"reason" : @"Error creating root certificate" }]; return; diff --git a/examples/darwin-framework-tool/commands/common/ControllerStorage.h b/examples/darwin-framework-tool/commands/common/ControllerStorage.h index f70081fee0..76811bcbb7 100644 --- a/examples/darwin-framework-tool/commands/common/ControllerStorage.h +++ b/examples/darwin-framework-tool/commands/common/ControllerStorage.h @@ -44,6 +44,7 @@ extern NSString * const kDarwinFrameworkToolControllerDomain; - (NSData *)valueForKey:(NSString *)key; - (void)storeValue:(NSData *)value forKey:key; +- (void)print; @end NS_ASSUME_NONNULL_END diff --git a/examples/darwin-framework-tool/commands/common/ControllerStorage.mm b/examples/darwin-framework-tool/commands/common/ControllerStorage.mm index 058f00a6b3..03685d445a 100644 --- a/examples/darwin-framework-tool/commands/common/ControllerStorage.mm +++ b/examples/darwin-framework-tool/commands/common/ControllerStorage.mm @@ -143,6 +143,20 @@ - (void)storeValue:(NSData *)value forKey:key self.storage[controllerKey] = value; } +- (void)print +{ + NSLog(@"%@ (%@)", kDarwinFrameworkToolControllerDomain, _keyScopingPrefix); + for (NSString * controllerKey in self.storage) { + if (![self _isControllerScopedKey:controllerKey]) { + continue; + } + + __auto_type * key = [self _controllerScopedKeyToKey:controllerKey]; + __auto_type * data = self.storage[controllerKey]; + NSLog(@" * %@: %@", key, data); + } +} + - (NSString *)_keyToControllerScopedKey:(NSString *)key { return [NSString stringWithFormat:@"%@%@", _keyScopingPrefix, key]; diff --git a/examples/darwin-framework-tool/commands/common/DeviceDelegate.h b/examples/darwin-framework-tool/commands/common/DeviceDelegate.h new file mode 100644 index 0000000000..97ab557429 --- /dev/null +++ b/examples/darwin-framework-tool/commands/common/DeviceDelegate.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +@interface DeviceDelegate : NSObject +- (void)setMaxIntervalForSubscription:(NSNumber *)maxInterval; +- (void)setPretendThreadEnabled:(BOOL)threadEnabled; +@end diff --git a/examples/darwin-framework-tool/commands/common/DeviceDelegate.mm b/examples/darwin-framework-tool/commands/common/DeviceDelegate.mm new file mode 100644 index 0000000000..1a7c82b46e --- /dev/null +++ b/examples/darwin-framework-tool/commands/common/DeviceDelegate.mm @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "DeviceDelegate.h" + +#include + +NS_ASSUME_NONNULL_BEGIN + +@interface DeviceDelegate () +@property (nonatomic, readwrite) NSNumber * maxIntervalForSubscription; +@property (nonatomic, readwrite) BOOL threadEnabled; +@end + +@implementation DeviceDelegate +- (instancetype)init +{ + if (self = [super init]) { + _maxIntervalForSubscription = nil; + _threadEnabled = NO; + } + return self; +} + +- (void)device:(MTRDevice *)device stateChanged:(MTRDeviceState)state +{ +} + +- (void)device:(MTRDevice *)device receivedAttributeReport:(NSArray *> *)attributeReport +{ +} + +- (void)device:(MTRDevice *)device receivedEventReport:(NSArray *> *)eventReport +{ +} + +- (void)deviceCachePrimed:(MTRDevice *)device +{ +} + +- (void)deviceConfigurationChanged:(MTRDevice *)device +{ +} + +- (void)setMaxIntervalForSubscription:(NSNumber *)maxInterval +{ + _maxIntervalForSubscription = maxInterval; +} + +- (NSNumber *)unitTestMaxIntervalOverrideForSubscription:(MTRDevice *)device +{ + return _maxIntervalForSubscription; +} + +- (void)setPretendThreadEnabled:(BOOL)threadEnabled +{ + _threadEnabled = threadEnabled; +} + +- (BOOL)unitTestPretendThreadEnabled:(MTRDevice *)device +{ + return _threadEnabled; +} +@end + +NS_ASSUME_NONNULL_END diff --git a/examples/darwin-framework-tool/commands/configuration/Commands.h b/examples/darwin-framework-tool/commands/configuration/Commands.h index 8ee148e63b..1466f1fd93 100644 --- a/examples/darwin-framework-tool/commands/configuration/Commands.h +++ b/examples/darwin-framework-tool/commands/configuration/Commands.h @@ -22,12 +22,14 @@ #include "ResetMRPParametersCommand.h" #include "SetMRPParametersCommand.h" +#include "SetUpDeviceCommand.h" void registerCommandsConfiguration(Commands & commands) { const char * clusterName = "Configuration"; commands_list clusterCommands = { + make_unique(), make_unique(), make_unique(), }; diff --git a/examples/darwin-framework-tool/commands/configuration/SetUpDeviceCommand.h b/examples/darwin-framework-tool/commands/configuration/SetUpDeviceCommand.h new file mode 100644 index 0000000000..14275b8c7b --- /dev/null +++ b/examples/darwin-framework-tool/commands/configuration/SetUpDeviceCommand.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#import "../common/DeviceDelegate.h" +#import + +#include + +class SetUpDeviceCommand : public CHIPCommandBridge { +public: + SetUpDeviceCommand() + : CHIPCommandBridge("device", "Creates and configures an instance of a device.") + { + AddArgument("node-id", 0, UINT64_MAX, &mNodeId, "The Node ID of the device instance to create."); + AddArgument("pretend-thread-enabled", 0, 1, &mPretendThreadEnabled, + "When the device is configured using an MTRDevice (via -use-mtr-device), instructs the MTRDevice to treat the " + "target device as a Thread device."); + AddArgument("max-interval", 0, UINT32_MAX, &mMaxIntervalForSubscription, + "When the device is configured using an MTRDevice (via --use-mtr-device), configure the maximum interval for the " + "delegate subscription."); + } + +protected: + /////////// CHIPCommandBridge Interface ///////// + CHIP_ERROR RunCommand() override + { + __auto_type * controller = CurrentCommissioner(); + VerifyOrReturnError(nil != controller, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * device = [MTRDevice deviceWithNodeID:@(mNodeId) controller:controller]; + VerifyOrReturnError(nil != device, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * delegate = ConfigureDelegate(); + __auto_type queue = dispatch_queue_create("com.chip.devicedelegate", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + [device addDelegate:delegate queue:queue]; + + // Make sure the device is registered as the latest MTRDevice. + DeviceWithNodeId(mNodeId); + + mDelegate = delegate; + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; + } + + // Our command is synchronous, so no need to wait. + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::kZero; } + +private: + DeviceDelegate * ConfigureDelegate() + { + __auto_type * delegate = [[DeviceDelegate alloc] init]; + + if (mPretendThreadEnabled.ValueOr(false)) { + [delegate setPretendThreadEnabled:YES]; + } + + if (mMaxIntervalForSubscription.HasValue()) { + [delegate setMaxIntervalForSubscription:@(mMaxIntervalForSubscription.Value())]; + } + + return delegate; + } + + DeviceDelegate * mDelegate; + + chip::NodeId mNodeId; + chip::Optional mPretendThreadEnabled; + chip::Optional mMaxIntervalForSubscription; +}; diff --git a/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm b/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm index 2652e2c236..a4bfbc234c 100644 --- a/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm +++ b/examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm @@ -27,16 +27,27 @@ #include #include -constexpr char kInteractiveModePrompt[] = "Stop and restart stack: [Ctrl+_] & [Ctrl+^]\n" - "Trigger exit(0): [Ctrl+@]\n" - "Quit Interactive: 'quit()'\n" - ">>> "; +constexpr char kInteractiveModeInstruction[] = "╔══════════════════════════════════════════════════════════════════╗\n" + "║ Interactive Mode ║\n" + "╠══════════════════════════════════════════════════════════════════╣\n" + "║ Stop and restart stack : [Ctrl+_] & [Ctrl+^ ] ║\n" + "║ Suspend/Resume controllers: [Ctrl+Z] ║\n" + "║ Trigger Resubscription : [Ctrl+G] ║\n" + "║ Trigger exit(0) : [Ctrl+@] ║\n" + "║ Quit Interactive : 'quit()' or `quit` ║\n" + "╚══════════════════════════════════════════════════════════════════╝\n"; +constexpr char kInteractiveModePrompt[] = ">>> "; constexpr char kInteractiveModeHistoryFilePath[] = "/tmp/darwin_framework_tool_history"; constexpr char kInteractiveModeStopCommand[] = "quit()"; +constexpr char kInteractiveModeStopAlternateCommand[] = "quit"; constexpr char kCategoryError[] = "Error"; constexpr char kCategoryProgress[] = "Info"; constexpr char kCategoryDetail[] = "Debug"; +@interface MTRDevice () +- (void)_deviceMayBeReachable; +@end + namespace { class RestartCommand : public CHIPCommandBridge { @@ -71,6 +82,41 @@ CHIP_ERROR RunCommand() override chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(0); } }; +class SuspendOrResumeCommand : public CHIPCommandBridge { +public: + SuspendOrResumeCommand() + : CHIPCommandBridge("suspend") + { + } + + CHIP_ERROR RunCommand() override + { + SuspendOrResumeCommissioners(); + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(0); } +}; + +class TriggerResubscriptionCommand : public CHIPCommandBridge { +public: + TriggerResubscriptionCommand() + : CHIPCommandBridge("trigger-resubscription") + { + } + + CHIP_ERROR RunCommand() override + { + __auto_type * device = GetLastUsedDevice(); + if (nil != device) { + [device _deviceMayBeReachable]; + } + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(0); } +}; + void ClearLine() { printf("\r\x1B[0J"); // Move cursor to the beginning of the line and clear from cursor to end of the screen @@ -277,6 +323,11 @@ void ENFORCE_FORMAT(3, 0) InteractiveServerLoggingCallback(const char * module, printf("%s\n", mAdditionalPrompt.Value()); ClearLine(); } + + ClearLine(); + printf("%s", kInteractiveModeInstruction); + ClearLine(); + command = readline(kInteractiveModePrompt); // Do not save empty lines @@ -302,6 +353,20 @@ el_status_t StopFunction() return CSstay; } +el_status_t SuspendOrResumeFunction() +{ + SuspendOrResumeCommand cmd; + cmd.RunCommand(); + return CSstay; +} + +el_status_t TriggerResubscriptionFunction() +{ + TriggerResubscriptionCommand cmd; + cmd.RunCommand(); + return CSstay; +} + el_status_t ExitFunction() { exit(0); @@ -323,6 +388,8 @@ el_status_t ExitFunction() el_bind_key(CTL('^'), RestartFunction); el_bind_key(CTL('_'), StopFunction); el_bind_key(CTL('@'), ExitFunction); + el_bind_key(CTL('Z'), SuspendOrResumeFunction); + el_bind_key(CTL('G'), TriggerResubscriptionFunction); char * command = nullptr; int status; @@ -391,7 +458,7 @@ el_status_t ExitFunction() bool InteractiveCommand::ParseCommand(char * command, int * status) { - if (strcmp(command, kInteractiveModeStopCommand) == 0) { + if (strcmp(command, kInteractiveModeStopCommand) == 0 || strcmp(command, kInteractiveModeStopAlternateCommand) == 0) { ExecuteDeferredCleanups(); return NO; } diff --git a/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.h b/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.h index 8c3ed69184..35e111e92e 100644 --- a/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.h +++ b/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.h @@ -33,7 +33,15 @@ class StorageClearAll : public Command class StorageViewAll : public Command { public: - StorageViewAll() : Command("view-all") {} + StorageViewAll() : Command("view") + { + AddArgument("commissioner-name", &mCommissionerName, + "If specified, only the keys associated with the given commissioner will be displayed. Valid options are: " + "‘alpha’, ‘beta’, ‘gamma’."); + } CHIP_ERROR Run() override; + +private: + chip::Optional mCommissionerName; }; diff --git a/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.mm b/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.mm index 007d2821bd..9e6e4b61f8 100644 --- a/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.mm +++ b/examples/darwin-framework-tool/commands/storage/StorageManagementCommand.mm @@ -49,11 +49,22 @@ CHIP_ERROR StorageViewAll::Run() { - __auto_type * domains = GetDomains(); - for (NSString * domain in domains) { - __auto_type * storage = [[PreferencesStorage alloc] initWithDomain:domain]; - [storage print]; + if (!mCommissionerName.HasValue()) { + __auto_type * domains = GetDomains(); + for (NSString * domain in domains) { + __auto_type * storage = [[PreferencesStorage alloc] initWithDomain:domain]; + [storage print]; + } + + return CHIP_NO_ERROR; } + const char * commissionerName = mCommissionerName.Value(); + __auto_type * fabricId = CHIPCommandBridge::GetCommissionerFabricId(commissionerName); + __auto_type * uuidString = [NSString stringWithFormat:@"%@%@", @(kControllerIdPrefix), fabricId]; + __auto_type * controllerId = [[NSUUID alloc] initWithUUIDString:uuidString]; + __auto_type * storage = [[ControllerStorage alloc] initWithControllerID:controllerId]; + [storage print]; + return CHIP_NO_ERROR; } diff --git a/examples/dishwasher-app/silabs/BUILD.gn b/examples/dishwasher-app/silabs/BUILD.gn index d024a5da95..c596a8a77e 100644 --- a/examples/dishwasher-app/silabs/BUILD.gn +++ b/examples/dishwasher-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -39,7 +39,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/dishwasher-app/silabs/README.md b/examples/dishwasher-app/silabs/README.md index 9a8a102cbd..ffc56f3580 100644 --- a/examples/dishwasher-app/silabs/README.md +++ b/examples/dishwasher-app/silabs/README.md @@ -10,6 +10,7 @@ An example showing the use of Matter on the Silicon Labs EFR32 MG24 boards. - [Flashing the Application](#flashing-the-application) - [Viewing Logging Output](#viewing-logging-output) - [Running the Complete Example](#running-the-complete-example) + - [Commissioning](#commissioning)
@@ -211,6 +212,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/dishwasher-app/silabs/build_for_wifi_args.gni b/examples/dishwasher-app/silabs/build_for_wifi_args.gni index 7e52816578..0a421db59d 100644 --- a/examples/dishwasher-app/silabs/build_for_wifi_args.gni +++ b/examples/dishwasher-app/silabs/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") sl_enable_test_event_trigger = true chip_enable_ota_requestor = true diff --git a/examples/dishwasher-app/silabs/build_for_wifi_gnfile.gn b/examples/dishwasher-app/silabs/build_for_wifi_gnfile.gn index d391814190..1d6a71e88d 100644 --- a/examples/dishwasher-app/silabs/build_for_wifi_gnfile.gn +++ b/examples/dishwasher-app/silabs/build_for_wifi_gnfile.gn @@ -24,5 +24,6 @@ default_args = { target_cpu = "arm" target_os = "freertos" chip_enable_wifi = true + chip_device_platform = "SiWx917" import("//build_for_wifi_args.gni") } diff --git a/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp b/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp index c751c71c26..cf7e4806a7 100644 --- a/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp +++ b/examples/dishwasher-app/silabs/src/ElectricalSensorManager.cpp @@ -196,12 +196,12 @@ void ElectricalSensorManager::UpdateEPMAttributes(OperationalStateEnum state) { if (gEPMDelegate) { - uint16_t updateState = to_underlying(state); - uint16_t ERROR_STATE_INDEX = ArraySize(kAttributes) - 1; + uint8_t updateState = to_underlying(state); + // Check state range - if ((updateState < 0) || (updateState > ERROR_STATE_INDEX)) + if (updateState >= ArraySize(kAttributes)) { - updateState = ERROR_STATE_INDEX; + updateState = ArraySize(kAttributes) - 1; } ChipLogDetail(AppServer, "UpdateAllAttributes to Operational State : %d", updateState); diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md index 615f1f50db..87b6d9dd93 100644 --- a/examples/energy-management-app/linux/README.md +++ b/examples/energy-management-app/linux/README.md @@ -24,6 +24,7 @@ details. - [Activating python virtual env](#activating-python-virtual-env) - [Interacting with CHIP-REPL and the example app](#interacting-with-chip-repl-and-the-example-app) - [Using chip-repl to Fake a charging session](#using-chip-repl-to-fake-a-charging-session) + - [Water Heater App: Interaction using the chip-tool and TestEventTriggers](#water-heater-app-interaction-using-the-chip-tool-and-testeventtriggers)
@@ -238,8 +239,9 @@ data (e.g. fabric info). ## CHIP-REPL Interaction -- See chip-repl documentation in - [Matter_REPL_Intro](../../../docs/guides/repl/Matter_REPL_Intro.ipynb) +- See chip-repl documentation in: + - [Working with Python CHIP Controller](../../../docs/development_controllers/chip-repl/python_chip_controller_building.md) + - [Matter_REPL_Intro](../../../docs/development_controllers/chip-repl/Matter_REPL_Intro.ipynb) ### Building chip-repl: @@ -272,7 +274,7 @@ data (e.g. fabric info). - Step 3: (In chip-repl) Commissioning OnNetwork ```python - devCtrl.CommissionOnNetwork(1234,20202021) # Commission with NodeID 1234 + await devCtrl.CommissionOnNetwork(1234,20202021) # Commission with NodeID 1234 Established secure session with Device Commissioning complete Out[2]: @@ -552,3 +554,62 @@ When we re-read the events: state was `kPluggedInCharging` prior to the EV being not detected (normally in a graceful shutdown this would be `kPluggedInNoDemand` or `kPluggedInDemand`). + +## Water Heater App: Interaction using the chip-tool and TestEventTriggers + +This section demonstrates how to run the Water Heater application and interact +with it using the `chip-tool` and `TestEventTriggers`. By default (at the time +of writing), the WaterHeater app does not configure some of its attributes with +simulated values (most default to 0). The steps below set the +[default](https://github.com/project-chip/connectedhomeip/blob/master/src/app/clusters/water-heater-management-server/WaterHeaterManagementTestEventTriggerHandler.h#L47) +`TestEventTrigger` which +`Simulate installation in a 100L tank full of water at 20C, with a target temperature of 60C, in OFF mode`. + +Step-by-step: + +1. Build the `energy-management-app` for linux: + + ``` + ./scripts/build/build_examples.py --target linux-x64-energy-management-no-ble build + ``` + +1. Run the Water Heater application: + + ``` + rm /tmp/chip_* && ./out/linux-x64-energy-management-no-ble/chip-energy-management-app --application water-heater --trace-to json:log --enable-key 000102030405060708090a0b0c0d0e0f + ``` + +1. Commission with chip-tool as node `0x12344321`: + + ``` + ./out/linux-x64-chip-tool-no-ble/chip-tool pairing code 0x12344321 MT:-24J0AFN00KA0648G00 + ``` + +1. Read the `TankVolume` attribute (expect 0 by default): + + ``` + ./out/linux-x64-chip-tool-no-ble/chip-tool waterheatermanagement read tank-volume 0x12344321 2 | grep TOO + + [1730306361.511] [2089549:2089552] [TOO] TankVolume: 0 + ``` + +1. Set the default TestEventTrigger (`0x0094000000000000`): + +- `0x0094000000000000` corresponds to `kBasicInstallationTestEvent` from + `WaterHeadermanagementTestEventTriggerHandler.h` +- `hex:00010203...0e0f` is the `--enable-key` passed to the startup of + chip-energy-management-app +- `0x12344321` is the node-id that the app was commissioned on +- final `0` is the endpoint on which the `GeneralDiagnostics` cluster exists + to call the `TestEventTrigger` command + ``` + ./out/linux-x64-chip-tool-no-ble/chip-tool generaldiagnostics test-event-trigger hex:000102030405060708090a0b0c0d0e0f 0x0094000000000000 0x12344321 0 + ``` + +1. Read TankVolume attribute again (now expect 100): + + ``` + ./out/linux-x64-chip-tool-no-ble/chip-tool waterheatermanagement read tank-volume 0x12344321 2 | grep TOO + + [1730312762.703] [2153606:2153609] [TOO] TankVolume: 100 + ``` diff --git a/examples/energy-management-app/silabs/BUILD.gn b/examples/energy-management-app/silabs/BUILD.gn index 624cfff625..d4a4887cee 100644 --- a/examples/energy-management-app/silabs/BUILD.gn +++ b/examples/energy-management-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -38,7 +38,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/energy-management-app/silabs/README.md b/examples/energy-management-app/silabs/README.md index 5c1955a507..2b565ec4b3 100644 --- a/examples/energy-management-app/silabs/README.md +++ b/examples/energy-management-app/silabs/README.md @@ -108,14 +108,14 @@ creating real products based on the Silicon Labs platform. To build the Water Heater example you can change the args to gn gen (see BUILD.gn for arg options) - $ gn gen out/debug --args='chip_enable_example_evse_device=false chip_enable_example_water_heater_device=true' + $ gn gen out/debug --args='sl_enable_example_evse_device=false sl_enable_example_water_heater_device=true' $ ninja -C out/debug To change Device Energy Management feature support (e.g. Power forecast or State forecast reporting), you can change the args to gn gen (see BUILD.gn for arg options) - $ gn gen out/debug --args='chip_dem_support_state_forecast_reporting=true chip_dem_support_power_forecast_reporting=false' + $ gn gen out/debug --args='sl_dem_support_state_forecast_reporting=true sl_dem_support_power_forecast_reporting=false' $ ninja -C out/debug - To delete generated executable, libraries and object files use: @@ -127,10 +127,6 @@ creating real products based on the Silicon Labs platform. $ ./scripts/examples/gn_silabs_example.sh ./examples/energy-management-app/silabs/ ./out/energy-management-app_ICD BRD4187C --icd - or use gn as previously mentioned but adding the following arguments: - - $ gn gen out/debug '--args=SILABS_BOARD="BRD4187C" enable_sleepy_device=true chip_openthread_ftd=false' - * Build the example with pigweed RPC $ ./scripts/examples/gn_silabs_example.sh examples/energy-management-app/silabs/ out/energy_management_app_rpc BRD4187C 'import("//with_pw_rpc.gni")' @@ -257,6 +253,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/energy-management-app/silabs/build_for_wifi_args.gni b/examples/energy-management-app/silabs/build_for_wifi_args.gni index 1b1c0ecd6a..feeffecd6f 100644 --- a/examples/energy-management-app/silabs/build_for_wifi_args.gni +++ b/examples/energy-management-app/silabs/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") sl_enable_test_event_trigger = true chip_enable_ota_requestor = false diff --git a/examples/fabric-admin/README.md b/examples/fabric-admin/README.md index c6b4ba7eb3..92fdffda6b 100644 --- a/examples/fabric-admin/README.md +++ b/examples/fabric-admin/README.md @@ -23,13 +23,13 @@ For Raspberry Pi 4 example: ### Pull Docker Images ``` -docker pull connectedhomeip/chip-build-vscode:latest +docker pull ghcr.io/project-chip/chip-build-crosscompile:90 ``` ### Run docker ``` -docker run -it -v ~/connectedhomeip:/var/connectedhomeip connectedhomeip/chip-build-vscode:latest /bin/bash +docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:90 /bin/bash ``` ### Build @@ -38,8 +38,6 @@ docker run -it -v ~/connectedhomeip:/var/connectedhomeip connectedhomeip/chip-bu cd /var/connectedhomeip git config --global --add safe.directory /var/connectedhomeip -git config --global --add safe.directory /var/connectedhomeip/third_party/pigweed/repo -git config --global --add safe.directory /var/connectedhomeip/examples/common/QRCode/repo ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ diff --git a/examples/fabric-admin/args.gni b/examples/fabric-admin/args.gni index 63c91c70c2..83300d797e 100644 --- a/examples/fabric-admin/args.gni +++ b/examples/fabric-admin/args.gni @@ -32,4 +32,3 @@ matter_log_json_payload_decode_full = true # make fabric-admin very strict by default chip_tlv_validate_char_string_on_read = true chip_tlv_validate_char_string_on_write = true -chip_enable_ble = true diff --git a/examples/fabric-admin/commands/common/CHIPCommand.cpp b/examples/fabric-admin/commands/common/CHIPCommand.cpp index c23ea82f20..e7f4071d12 100644 --- a/examples/fabric-admin/commands/common/CHIPCommand.cpp +++ b/examples/fabric-admin/commands/common/CHIPCommand.cpp @@ -182,7 +182,7 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack() mCredIssuerCmds->SetCredentialIssuerOption(CredentialIssuerCommands::CredentialIssuerOptions::kAllowTestCdSigningKey, allowTestCdSigningKey); - ReturnLogErrorOnFailure(PairingManager::Instance().Init(&CurrentCommissioner(), mCredIssuerCmds)); + ReturnLogErrorOnFailure(admin::PairingManager::Instance().Init(&CurrentCommissioner(), mCredIssuerCmds)); return CHIP_NO_ERROR; } diff --git a/examples/fabric-admin/commands/fabric-sync/Commands.h b/examples/fabric-admin/commands/fabric-sync/Commands.h index 47f7207922..0f2f3f64c3 100644 --- a/examples/fabric-admin/commands/fabric-sync/Commands.h +++ b/examples/fabric-admin/commands/fabric-sync/Commands.h @@ -26,11 +26,11 @@ void registerCommandsFabricSync(Commands & commands, CredentialIssuerCommands * const char * clusterName = "FabricSync"; commands_list clusterCommands = { - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), }; commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for fabric synchronization."); diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index f10db13e93..315bf2f371 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -30,6 +30,8 @@ using namespace ::chip; +namespace admin { + void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) { if (mBridgeNodeId != deviceId) @@ -49,14 +51,14 @@ void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_E if (err == CHIP_NO_ERROR) { - DeviceMgr().SetRemoteBridgeNodeId(mBridgeNodeId); + DeviceManager::Instance().SetRemoteBridgeNodeId(mBridgeNodeId); ChipLogProgress(NotSpecified, "Successfully paired bridge device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mBridgeNodeId)); - DeviceMgr().UpdateLastUsedNodeId(mBridgeNodeId); - DeviceMgr().SubscribeRemoteFabricBridge(); + DeviceManager::Instance().UpdateLastUsedNodeId(mBridgeNodeId); + DeviceManager::Instance().SubscribeRemoteFabricBridge(); - if (DeviceMgr().IsLocalBridgeReady()) + if (DeviceManager::Instance().IsLocalBridgeReady()) { // After successful commissioning of the Commissionee, initiate Reverse Commissioning // via the Commissioner Control Cluster. However, we must first verify that the @@ -64,7 +66,7 @@ void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_E // // Note: The Fabric-Admin MUST NOT send the RequestCommissioningApproval command // if the remote Fabric-Bridge lacks Fabric Synchronization support. - DeviceLayer::SystemLayer().ScheduleLambda([]() { DeviceMgr().ReadSupportedDeviceCategories(); }); + DeviceLayer::SystemLayer().ScheduleLambda([]() { DeviceManager::Instance().ReadSupportedDeviceCategories(); }); } } else @@ -78,18 +80,19 @@ void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_E CHIP_ERROR FabricSyncAddBridgeCommand::RunCommand(NodeId remoteId) { - if (DeviceMgr().IsFabricSyncReady()) + if (DeviceManager::Instance().IsFabricSyncReady()) { // print to console - fprintf(stderr, "Remote Fabric Bridge has already been configured."); + fprintf(stderr, "Remote Fabric Bridge has already been configured.\n"); return CHIP_NO_ERROR; } - PairingManager::Instance().SetCommissioningDelegate(this); + PairingManager::Instance().SetPairingDelegate(this); mBridgeNodeId = remoteId; - DeviceMgr().PairRemoteFabricBridge(remoteId, mSetupPINCode, reinterpret_cast(mRemoteAddr.data()), mRemotePort); + DeviceManager::Instance().PairRemoteFabricBridge(remoteId, mSetupPINCode, reinterpret_cast(mRemoteAddr.data()), + mRemotePort); return CHIP_NO_ERROR; } @@ -104,7 +107,7 @@ void FabricSyncRemoveBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR if (err == CHIP_NO_ERROR) { - DeviceMgr().SetRemoteBridgeNodeId(kUndefinedNodeId); + DeviceManager::Instance().SetRemoteBridgeNodeId(kUndefinedNodeId); ChipLogProgress(NotSpecified, "Successfully removed bridge device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mBridgeNodeId)); } @@ -119,19 +122,19 @@ void FabricSyncRemoveBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR CHIP_ERROR FabricSyncRemoveBridgeCommand::RunCommand() { - NodeId bridgeNodeId = DeviceMgr().GetRemoteBridgeNodeId(); + NodeId bridgeNodeId = DeviceManager::Instance().GetRemoteBridgeNodeId(); if (bridgeNodeId == kUndefinedNodeId) { // print to console - fprintf(stderr, "Remote Fabric Bridge is not configured yet, nothing to remove."); + fprintf(stderr, "Remote Fabric Bridge is not configured yet, nothing to remove.\n"); return CHIP_NO_ERROR; } mBridgeNodeId = bridgeNodeId; PairingManager::Instance().SetPairingDelegate(this); - DeviceMgr().UnpairRemoteFabricBridge(); + DeviceManager::Instance().UnpairRemoteFabricBridge(); return CHIP_NO_ERROR; } @@ -155,8 +158,8 @@ void FabricSyncAddLocalBridgeCommand::OnCommissioningComplete(NodeId deviceId, C if (err == CHIP_NO_ERROR) { - DeviceMgr().SetLocalBridgeNodeId(mLocalBridgeNodeId); - DeviceMgr().UpdateLastUsedNodeId(mLocalBridgeNodeId); + DeviceManager::Instance().SetLocalBridgeNodeId(mLocalBridgeNodeId); + DeviceManager::Instance().UpdateLastUsedNodeId(mLocalBridgeNodeId); ChipLogProgress(NotSpecified, "Successfully paired local bridge device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mLocalBridgeNodeId)); } @@ -171,26 +174,26 @@ void FabricSyncAddLocalBridgeCommand::OnCommissioningComplete(NodeId deviceId, C CHIP_ERROR FabricSyncAddLocalBridgeCommand::RunCommand(NodeId deviceId) { - if (DeviceMgr().IsLocalBridgeReady()) + if (DeviceManager::Instance().IsLocalBridgeReady()) { // print to console - fprintf(stderr, "Local Fabric Bridge has already been configured."); + fprintf(stderr, "Local Fabric Bridge has already been configured.\n"); return CHIP_NO_ERROR; } - PairingManager::Instance().SetCommissioningDelegate(this); + PairingManager::Instance().SetPairingDelegate(this); mLocalBridgeNodeId = deviceId; if (mSetupPINCode.HasValue()) { - DeviceMgr().SetLocalBridgeSetupPinCode(mSetupPINCode.Value()); + DeviceManager::Instance().SetLocalBridgeSetupPinCode(mSetupPINCode.Value()); } if (mLocalPort.HasValue()) { - DeviceMgr().SetLocalBridgePort(mLocalPort.Value()); + DeviceManager::Instance().SetLocalBridgePort(mLocalPort.Value()); } - DeviceMgr().PairLocalFabricBridge(deviceId); + DeviceManager::Instance().PairLocalFabricBridge(deviceId); return CHIP_NO_ERROR; } @@ -205,7 +208,7 @@ void FabricSyncRemoveLocalBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_E if (err == CHIP_NO_ERROR) { - DeviceMgr().SetLocalBridgeNodeId(kUndefinedNodeId); + DeviceManager::Instance().SetLocalBridgeNodeId(kUndefinedNodeId); ChipLogProgress(NotSpecified, "Successfully removed local bridge device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mLocalBridgeNodeId)); } @@ -220,19 +223,19 @@ void FabricSyncRemoveLocalBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_E CHIP_ERROR FabricSyncRemoveLocalBridgeCommand::RunCommand() { - NodeId bridgeNodeId = DeviceMgr().GetLocalBridgeNodeId(); + NodeId bridgeNodeId = DeviceManager::Instance().GetLocalBridgeNodeId(); if (bridgeNodeId == kUndefinedNodeId) { // print to console - fprintf(stderr, "Local Fabric Bridge is not configured yet, nothing to remove."); + fprintf(stderr, "Local Fabric Bridge is not configured yet, nothing to remove.\n"); return CHIP_NO_ERROR; } mLocalBridgeNodeId = bridgeNodeId; PairingManager::Instance().SetPairingDelegate(this); - DeviceMgr().UnpairLocalFabricBridge(); + DeviceManager::Instance().UnpairLocalFabricBridge(); return CHIP_NO_ERROR; } @@ -248,14 +251,14 @@ void FabricSyncDeviceCommand::OnCommissioningWindowOpened(NodeId deviceId, CHIP_ CHIP_ERROR error = ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(manualCode); if (error == CHIP_NO_ERROR) { - NodeId nodeId = DeviceMgr().GetNextAvailableNodeId(); + NodeId nodeId = DeviceManager::Instance().GetNextAvailableNodeId(); - PairingManager::Instance().SetCommissioningDelegate(this); + PairingManager::Instance().SetPairingDelegate(this); mAssignedNodeId = nodeId; usleep(kCommissionPrepareTimeMs * 1000); - DeviceMgr().PairRemoteDevice(nodeId, payloadBuffer); + DeviceManager::Instance().PairRemoteDevice(nodeId, payloadBuffer); } else { @@ -281,7 +284,7 @@ void FabricSyncDeviceCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERRO if (err == CHIP_NO_ERROR) { - DeviceMgr().AddSyncedDevice(Device(mAssignedNodeId, mRemoteEndpointId)); + DeviceManager::Instance().AddSyncedDevice(Device(mAssignedNodeId, mRemoteEndpointId)); } else { @@ -290,18 +293,20 @@ void FabricSyncDeviceCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERRO } } -CHIP_ERROR FabricSyncDeviceCommand::RunCommand(EndpointId remoteId) +CHIP_ERROR FabricSyncDeviceCommand::RunCommand(EndpointId remoteEndpointId) { - if (!DeviceMgr().IsFabricSyncReady()) + if (!DeviceManager::Instance().IsFabricSyncReady()) { // print to console - fprintf(stderr, "Remote Fabric Bridge is not configured yet."); + fprintf(stderr, "Remote Fabric Bridge is not configured yet.\n"); return CHIP_NO_ERROR; } PairingManager::Instance().SetOpenCommissioningWindowDelegate(this); - DeviceMgr().OpenRemoteDeviceCommissioningWindow(remoteId); + DeviceManager::Instance().OpenRemoteDeviceCommissioningWindow(remoteEndpointId); return CHIP_NO_ERROR; } + +} // namespace admin diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h index 8d14529155..444fb96a9a 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h @@ -21,10 +21,12 @@ #include #include +namespace admin { + // Constants constexpr uint32_t kCommissionPrepareTimeMs = 500; -class FabricSyncAddBridgeCommand : public CHIPCommand, public CommissioningDelegate +class FabricSyncAddBridgeCommand : public CHIPCommand, public PairingDelegate { public: FabricSyncAddBridgeCommand(CredentialIssuerCommands * credIssuerCommands) : CHIPCommand("add-bridge", credIssuerCommands) @@ -69,7 +71,7 @@ class FabricSyncRemoveBridgeCommand : public CHIPCommand, public PairingDelegate chip::NodeId mBridgeNodeId; }; -class FabricSyncAddLocalBridgeCommand : public CHIPCommand, public CommissioningDelegate +class FabricSyncAddLocalBridgeCommand : public CHIPCommand, public PairingDelegate { public: FabricSyncAddLocalBridgeCommand(CredentialIssuerCommands * credIssuerCommands) : @@ -114,7 +116,7 @@ class FabricSyncRemoveLocalBridgeCommand : public CHIPCommand, public PairingDel chip::NodeId mLocalBridgeNodeId; }; -class FabricSyncDeviceCommand : public CHIPCommand, public CommissioningWindowDelegate, public CommissioningDelegate +class FabricSyncDeviceCommand : public CHIPCommand, public CommissioningWindowDelegate, public PairingDelegate { public: FabricSyncDeviceCommand(CredentialIssuerCommands * credIssuerCommands) : CHIPCommand("sync-device", credIssuerCommands) @@ -122,8 +124,8 @@ class FabricSyncDeviceCommand : public CHIPCommand, public CommissioningWindowDe AddArgument("endpointid", 0, UINT16_MAX, &mRemoteEndpointId); } - void OnCommissioningWindowOpened(NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload) override; - void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) override; + void OnCommissioningWindowOpened(chip::NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload) override; + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override; /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override { return RunCommand(mRemoteEndpointId); } @@ -134,5 +136,7 @@ class FabricSyncDeviceCommand : public CHIPCommand, public CommissioningWindowDe chip::EndpointId mRemoteEndpointId = chip::kInvalidEndpointId; chip::NodeId mAssignedNodeId = chip::kUndefinedNodeId; - CHIP_ERROR RunCommand(chip::EndpointId remoteId); + CHIP_ERROR RunCommand(chip::EndpointId remoteEndpointId); }; + +} // namespace admin diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp index 0209a78373..bd35225726 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp @@ -117,7 +117,7 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, #if defined(PW_RPC_ENABLED) void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) { - if (StartRpcClient() == CHIP_NO_ERROR) + if (admin::StartRpcClient() == CHIP_NO_ERROR) { // print to console fprintf(stderr, "Connected to Fabric-Bridge\n"); @@ -199,8 +199,8 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() } #if defined(PW_RPC_ENABLED) - SetRpcRemoteServerPort(mFabricBridgeServerPort.Value()); - InitRpcServer(mLocalServerPort.Value()); + admin::SetRpcRemoteServerPort(mFabricBridgeServerPort.Value()); + admin::InitRpcServer(mLocalServerPort.Value()); ChipLogProgress(NotSpecified, "PW_RPC initialized."); DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0); #endif diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.cpp b/examples/fabric-admin/commands/pairing/PairingCommand.cpp index 37578472b7..5ac731871f 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.cpp +++ b/examples/fabric-admin/commands/pairing/PairingCommand.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -33,10 +34,6 @@ #include -#if defined(PW_RPC_ENABLED) -#include -#endif - using namespace ::chip; using namespace ::chip::Controller; @@ -405,7 +402,7 @@ void PairingCommand::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) fprintf(stderr, "New device with Node ID: 0x%lx has been successfully added.\n", nodeId); // CurrentCommissioner() has a lifetime that is the entire life of the application itself // so it is safe to provide to StartDeviceSynchronization. - DeviceSynchronizer::Instance().StartDeviceSynchronization(&CurrentCommissioner(), mNodeId, mDeviceIsICD); + admin::DeviceSynchronizer::Instance().StartDeviceSynchronization(&CurrentCommissioner(), mNodeId, mDeviceIsICD); } else { @@ -534,16 +531,16 @@ void PairingCommand::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E PairingCommand * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(NotSpecified, "OnCurrentFabricRemove: context is null")); + ChipLogProgress(NotSpecified, "PairingCommand::OnCurrentFabricRemove"); + if (err == CHIP_NO_ERROR) { // print to console fprintf(stderr, "Device with Node ID: 0x%lx has been successfully removed.\n", nodeId); -#if defined(PW_RPC_ENABLED) app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(command->CurrentCommissioner().GetFabricIndex(), nodeId); ScopedNodeId scopedNodeId(nodeId, command->CurrentCommissioner().GetFabricIndex()); - RemoveSynchronizedDevice(scopedNodeId); -#endif + admin::DeviceManager::Instance().RemoveSyncedDevice(scopedNodeId); } else { diff --git a/examples/fabric-admin/device_manager/BridgeSubscription.cpp b/examples/fabric-admin/device_manager/BridgeSubscription.cpp index 2efcadaaa6..1df9371ff7 100644 --- a/examples/fabric-admin/device_manager/BridgeSubscription.cpp +++ b/examples/fabric-admin/device_manager/BridgeSubscription.cpp @@ -17,12 +17,14 @@ */ #include "BridgeSubscription.h" -#include +#include "DeviceManager.h" using namespace ::chip; using namespace ::chip::app; using chip::app::ReadClient; +namespace admin { + namespace { constexpr uint16_t kSubscribeMinInterval = 0; @@ -78,7 +80,7 @@ void BridgeSubscription::OnAttributeData(const ConcreteDataAttributePath & path, return; } - DeviceMgr().HandleAttributeData(path, *data); + DeviceManager::Instance().HandleAttributeData(path, *data); } void BridgeSubscription::OnEventData(const app::EventHeader & eventHeader, TLV::TLVReader * data, const app::StatusIB * status) @@ -99,7 +101,7 @@ void BridgeSubscription::OnEventData(const app::EventHeader & eventHeader, TLV:: return; } - DeviceMgr().HandleEventData(eventHeader, *data); + DeviceManager::Instance().HandleEventData(eventHeader, *data); } void BridgeSubscription::OnError(CHIP_ERROR error) @@ -157,3 +159,5 @@ void BridgeSubscription::OnDeviceConnectionFailure(const ScopedNodeId & peerId, ChipLogError(NotSpecified, "BridgeSubscription failed to connect to " ChipLogFormatX64, ChipLogValueX64(peerId.GetNodeId())); OnDone(nullptr); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/BridgeSubscription.h b/examples/fabric-admin/device_manager/BridgeSubscription.h index bd2a70279a..e5f8c73fc1 100644 --- a/examples/fabric-admin/device_manager/BridgeSubscription.h +++ b/examples/fabric-admin/device_manager/BridgeSubscription.h @@ -24,6 +24,8 @@ #include #include +namespace admin { + /** * @brief Class used to subscribe to attributes and events from the remote bridged device. * @@ -75,3 +77,5 @@ class BridgeSubscription : public chip::app::ReadClient::Callback chip::EndpointId mEndpointId; bool subscriptionStarted = false; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/CommissionerControl.cpp b/examples/fabric-admin/device_manager/CommissionerControl.cpp index b919ceb068..3c6dfa5a8a 100644 --- a/examples/fabric-admin/device_manager/CommissionerControl.cpp +++ b/examples/fabric-admin/device_manager/CommissionerControl.cpp @@ -1,8 +1,10 @@ #include "CommissionerControl.h" -#include +#include "DeviceManager.h" using namespace ::chip; +namespace admin { + void CommissionerControl::Init(Controller::DeviceCommissioner & commissioner, NodeId nodeId, EndpointId endpointId) { // Ensure that mCommissioner is not already initialized @@ -64,7 +66,7 @@ void CommissionerControl::OnResponse(app::CommandSender * client, const app::Con if (data != nullptr) { - DeviceMgr().HandleCommandResponse(path, *data); + DeviceManager::Instance().HandleCommandResponse(path, *data); } } @@ -102,6 +104,9 @@ void CommissionerControl::OnDone(app::CommandSender * client) CHIP_ERROR CommissionerControl::SendCommandForType(CommandType commandType, DeviceProxy * device) { + ChipLogProgress(AppServer, "Sending command with Endpoint ID: %d, Command Type: %d", mEndpointId, + static_cast(commandType)); + switch (commandType) { case CommandType::kRequestCommissioningApproval: @@ -139,3 +144,5 @@ void CommissionerControl::OnDeviceConnectionFailureFn(void * context, const Scop VerifyOrReturn(self != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null")); self->OnDone(nullptr); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/CommissionerControl.h b/examples/fabric-admin/device_manager/CommissionerControl.h index 1fad323e12..392367d6c0 100644 --- a/examples/fabric-admin/device_manager/CommissionerControl.h +++ b/examples/fabric-admin/device_manager/CommissionerControl.h @@ -21,6 +21,8 @@ #include #include +namespace admin { + /** * @class CommissionerControl * @brief This class handles sending CHIP commands related to commissioning, including sending @@ -123,3 +125,5 @@ class CommissionerControl : public chip::app::CommandSender::Callback chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::Type mRequestCommissioningApproval; chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Type mCommissionNode; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index e52027c8f5..9f40f92a87 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -25,8 +25,14 @@ #include #include +#if defined(PW_RPC_ENABLED) +#include +#endif + using namespace chip; +namespace admin { + namespace { constexpr EndpointId kAggregatorEndpointId = 1; @@ -36,9 +42,6 @@ constexpr uint16_t kMaxDiscriminatorLength = 4095; } // namespace -// Define the static member -DeviceManager DeviceManager::sInstance; - void DeviceManager::Init() { // TODO: (#34113) Init mLastUsedNodeId from chip config file @@ -69,7 +72,11 @@ void DeviceManager::UpdateLastUsedNodeId(NodeId nodeId) void DeviceManager::SetRemoteBridgeNodeId(chip::NodeId nodeId) { mRemoteBridgeNodeId = nodeId; - mCommissionerControl.Init(PairingManager::Instance().CurrentCommissioner(), mRemoteBridgeNodeId, kAggregatorEndpointId); + + if (mRemoteBridgeNodeId != kUndefinedNodeId) + { + mCommissionerControl.Init(PairingManager::Instance().CurrentCommissioner(), mRemoteBridgeNodeId, kAggregatorEndpointId); + } } void DeviceManager::AddSyncedDevice(const Device & device) @@ -103,8 +110,13 @@ Device * DeviceManager::FindDeviceByNode(NodeId nodeId) return nullptr; } -void DeviceManager::RemoveSyncedDevice(NodeId nodeId) +void DeviceManager::RemoveSyncedDevice(chip::ScopedNodeId scopedNodeId) { +#if defined(PW_RPC_ENABLED) + RemoveSynchronizedDevice(scopedNodeId); +#endif + + NodeId nodeId = scopedNodeId.GetNodeId(); Device * device = FindDeviceByNode(nodeId); if (device == nullptr) { @@ -253,6 +265,10 @@ void DeviceManager::HandleReadSupportedDeviceCategories(TLV::TLVReader & data) ChipLogProgress(NotSpecified, "Remote Fabric-Bridge supports Fabric Synchronization, start reverse commissioning."); RequestCommissioningApproval(); } + else + { + ChipLogProgress(NotSpecified, "Remote Fabric-Bridge does not support Fabric Synchronization."); + } } void DeviceManager::RequestCommissioningApproval() @@ -400,6 +416,8 @@ void DeviceManager::SendCommissionNodeRequest(uint64_t requestId, uint16_t respo void DeviceManager::HandleReverseOpenCommissioningWindow(TLV::TLVReader & data) { + ChipLogProgress(NotSpecified, "Handle ReverseOpenCommissioningWindow command."); + app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType value; CHIP_ERROR error = app::DataModel::Decode(data, value); @@ -453,15 +471,4 @@ void DeviceManager::HandleCommandResponse(const app::ConcreteCommandPath & path, } } -void DeviceManager::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR err) -{ - if (err != CHIP_NO_ERROR) - { - ChipLogError(NotSpecified, "Failed to remove synced device:(" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, - ChipLogValueX64(deviceId), err.Format()); - return; - } - - RemoveSyncedDevice(deviceId); - ChipLogProgress(NotSpecified, "Synced device with NodeId:" ChipLogFormatX64 " has been removed.", ChipLogValueX64(deviceId)); -} +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceManager.h b/examples/fabric-admin/device_manager/DeviceManager.h index 6adc8f243e..594fcfc574 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.h +++ b/examples/fabric-admin/device_manager/DeviceManager.h @@ -26,6 +26,8 @@ #include #include +namespace admin { + constexpr uint32_t kDefaultSetupPinCode = 20202021; constexpr uint16_t kDefaultLocalBridgePort = 5540; constexpr uint16_t kResponseTimeoutSeconds = 30; @@ -48,11 +50,17 @@ class Device chip::EndpointId mEndpointId; }; -class DeviceManager : public PairingDelegate +class DeviceManager { public: DeviceManager() = default; + static DeviceManager & Instance() + { + static DeviceManager instance; + return instance; + } + void Init(); chip::NodeId GetNextAvailableNodeId(); @@ -75,7 +83,7 @@ class DeviceManager : public PairingDelegate void AddSyncedDevice(const Device & device); - void RemoveSyncedDevice(chip::NodeId nodeId); + void RemoveSyncedDevice(chip::ScopedNodeId scopedNodeId); /** * @brief Determines whether a given nodeId corresponds to the "current bridge device," either local or remote. @@ -173,10 +181,6 @@ class DeviceManager : public PairingDelegate Device * FindDeviceByNode(chip::NodeId nodeId); private: - friend DeviceManager & DeviceMgr(); - - void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; - void RequestCommissioningApproval(); void HandleReadSupportedDeviceCategories(chip::TLV::TLVReader & data); @@ -212,17 +216,4 @@ class DeviceManager : public PairingDelegate FabricSyncGetter mFabricSyncGetter; }; -/** - * Returns the public interface of the DeviceManager singleton object. - * - * Applications should use this to access features of the DeviceManager - * object. - */ -inline DeviceManager & DeviceMgr() -{ - if (!DeviceManager::sInstance.mInitialized) - { - DeviceManager::sInstance.Init(); - } - return DeviceManager::sInstance; -} +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceSubscription.cpp b/examples/fabric-admin/device_manager/DeviceSubscription.cpp index 434d349e8c..996656a0de 100644 --- a/examples/fabric-admin/device_manager/DeviceSubscription.cpp +++ b/examples/fabric-admin/device_manager/DeviceSubscription.cpp @@ -33,6 +33,8 @@ using namespace ::chip; using namespace ::chip::app; using chip::app::ReadClient; +namespace admin { + namespace { void OnDeviceConnectedWrapper(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) @@ -281,3 +283,5 @@ void DeviceSubscription::StopSubscription() MoveToState(State::AwaitingDestruction); mOnDoneCallback(mScopedNodeId); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceSubscription.h b/examples/fabric-admin/device_manager/DeviceSubscription.h index 8db31d6e90..808da10c32 100644 --- a/examples/fabric-admin/device_manager/DeviceSubscription.h +++ b/examples/fabric-admin/device_manager/DeviceSubscription.h @@ -20,7 +20,6 @@ #include #include #include - #include #if defined(PW_RPC_ENABLED) @@ -28,6 +27,8 @@ #include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" #endif +namespace admin { + class DeviceSubscriptionManager; /// Attribute subscription to attributes that are important to keep track and send to fabric-bridge @@ -95,3 +96,5 @@ class DeviceSubscription : public chip::app::ReadClient::Callback bool mChangeDetected = false; State mState = State::Idle; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp b/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp index 0410c162a8..46f94c99c8 100644 --- a/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp @@ -32,11 +32,7 @@ using namespace ::chip; using namespace ::chip::app; -DeviceSubscriptionManager & DeviceSubscriptionManager::Instance() -{ - static DeviceSubscriptionManager instance; - return instance; -} +namespace admin { CHIP_ERROR DeviceSubscriptionManager::StartSubscription(Controller::DeviceController & controller, ScopedNodeId scopedNodeId) { @@ -78,3 +74,5 @@ void DeviceSubscriptionManager::DeviceSubscriptionTerminated(ScopedNodeId scoped VerifyOrDie(it != mDeviceSubscriptionMap.end()); mDeviceSubscriptionMap.erase(scopedNodeId); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceSubscriptionManager.h b/examples/fabric-admin/device_manager/DeviceSubscriptionManager.h index 1b5c45fd05..5f04522dcc 100644 --- a/examples/fabric-admin/device_manager/DeviceSubscriptionManager.h +++ b/examples/fabric-admin/device_manager/DeviceSubscriptionManager.h @@ -25,10 +25,16 @@ #include +namespace admin { + class DeviceSubscriptionManager { public: - static DeviceSubscriptionManager & Instance(); + static DeviceSubscriptionManager & Instance() + { + static DeviceSubscriptionManager instance; + return instance; + } /// Usually called after we have added a synchronized device to fabric-bridge to monitor /// for any changes that need to be propagated to fabric-bridge. @@ -52,3 +58,5 @@ class DeviceSubscriptionManager std::unordered_map, ScopedNodeIdHasher> mDeviceSubscriptionMap; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceSynchronization.cpp b/examples/fabric-admin/device_manager/DeviceSynchronization.cpp index 1e8728ee59..092c2505d1 100644 --- a/examples/fabric-admin/device_manager/DeviceSynchronization.cpp +++ b/examples/fabric-admin/device_manager/DeviceSynchronization.cpp @@ -35,6 +35,8 @@ using namespace ::chip; using namespace ::chip::app; using chip::app::ReadClient; +namespace admin { + namespace { void OnDeviceConnectedWrapper(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) @@ -141,7 +143,7 @@ void DeviceSynchronizer::OnReportEnd() void DeviceSynchronizer::OnDone(app::ReadClient * apReadClient) { #if defined(PW_RPC_ENABLED) - if (mState == State::ReceivedResponse && !DeviceMgr().IsCurrentBridgeDevice(mNodeId)) + if (mState == State::ReceivedResponse && !DeviceManager::Instance().IsCurrentBridgeDevice(mNodeId)) { GetUniqueId(); if (mState == State::GettingUid) @@ -228,15 +230,15 @@ void DeviceSynchronizer::GetUniqueId() VerifyOrReturn(!mCurrentDeviceData.has_unique_id, ChipLogDetail(NotSpecified, "We already have UniqueId")); #endif - auto * device = DeviceMgr().FindDeviceByNode(mNodeId); + auto * device = DeviceManager::Instance().FindDeviceByNode(mNodeId); // If there is no associated remote Fabric Sync Aggregator there is no other place for us to try // getting the UniqueId from and can return leaving the state in ReceivedResponse. VerifyOrReturn(device, ChipLogDetail(NotSpecified, "No remote Fabric Sync Aggregator to get UniqueId from")); // Because device is not-null we expect IsFabricSyncReady to be true. IsFabricSyncReady indicates we have a // connection to the remote Fabric Sync Aggregator. - VerifyOrDie(DeviceMgr().IsFabricSyncReady()); - auto remoteBridgeNodeId = DeviceMgr().GetRemoteBridgeNodeId(); + VerifyOrDie(DeviceManager::Instance().IsFabricSyncReady()); + auto remoteBridgeNodeId = DeviceManager::Instance().GetRemoteBridgeNodeId(); EndpointId remoteEndpointIdOfInterest = device->GetEndpointId(); ChipLogDetail(NotSpecified, "Attempting to get UniqueId from remote Fabric Sync Aggregator"); @@ -324,3 +326,5 @@ const char * DeviceSynchronizer::GetStateStr() const } return "N/A"; } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/DeviceSynchronization.h b/examples/fabric-admin/device_manager/DeviceSynchronization.h index 28880c6fae..8f089ef653 100644 --- a/examples/fabric-admin/device_manager/DeviceSynchronization.h +++ b/examples/fabric-admin/device_manager/DeviceSynchronization.h @@ -22,7 +22,6 @@ #include #include #include - #include #if defined(PW_RPC_ENABLED) @@ -30,6 +29,8 @@ #include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" #endif +namespace admin { + /// Ensures that device data is synchronized to the remote fabric bridge. /// /// Includes a state machine that: @@ -100,3 +101,5 @@ class DeviceSynchronizer : public chip::app::ReadClient::Callback #endif UniqueIdGetter mUniqueIdGetter; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/FabricSyncGetter.cpp b/examples/fabric-admin/device_manager/FabricSyncGetter.cpp index 5201048c3f..7e51180907 100644 --- a/examples/fabric-admin/device_manager/FabricSyncGetter.cpp +++ b/examples/fabric-admin/device_manager/FabricSyncGetter.cpp @@ -22,6 +22,8 @@ using namespace ::chip; using namespace ::chip::app; using chip::app::ReadClient; +namespace admin { + namespace { void OnDeviceConnectedWrapper(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) @@ -119,3 +121,5 @@ void FabricSyncGetter::OnDeviceConnectionFailure(const ScopedNodeId & peerId, CH OnDone(nullptr); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/FabricSyncGetter.h b/examples/fabric-admin/device_manager/FabricSyncGetter.h index d6d3a5bce8..bed3c2fbb5 100644 --- a/examples/fabric-admin/device_manager/FabricSyncGetter.h +++ b/examples/fabric-admin/device_manager/FabricSyncGetter.h @@ -24,6 +24,8 @@ #include #include +namespace admin { + /** * @brief Class used to get FabricSynchronization from SupportedDeviceCategories attribute of Commissioner Control Cluster. * @@ -73,3 +75,5 @@ class FabricSyncGetter : public chip::app::ReadClient::Callback chip::Callback::Callback mOnDeviceConnectedCallback; chip::Callback::Callback mOnDeviceConnectionFailureCallback; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/PairingManager.cpp b/examples/fabric-admin/device_manager/PairingManager.cpp index 41b4c8744e..8474d78f02 100644 --- a/examples/fabric-admin/device_manager/PairingManager.cpp +++ b/examples/fabric-admin/device_manager/PairingManager.cpp @@ -23,18 +23,17 @@ #include #include +#include #include #include #include #include -#if defined(PW_RPC_ENABLED) -#include -#endif - using namespace ::chip; using namespace ::chip::Controller; +namespace admin { + namespace { CHIP_ERROR GetPayload(const char * setUpCode, SetupPayload & payload) @@ -310,10 +309,10 @@ void PairingManager::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) ChipLogProgress(NotSpecified, "Device commissioning Failure: %s", ErrorStr(err)); } - if (mCommissioningDelegate) + if (mPairingDelegate) { - mCommissioningDelegate->OnCommissioningComplete(nodeId, err); - SetCommissioningDelegate(nullptr); + mPairingDelegate->OnCommissioningComplete(nodeId, err); + SetPairingDelegate(nullptr); } } @@ -545,17 +544,23 @@ void PairingManager::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E PairingManager * self = reinterpret_cast(context); VerifyOrReturn(self != nullptr, ChipLogError(NotSpecified, "OnCurrentFabricRemove: context is null")); + ChipLogProgress(NotSpecified, "PairingManager::OnCurrentFabricRemove"); + if (err == CHIP_NO_ERROR) { // print to console - fprintf(stderr, "Device with Node ID: " ChipLogFormatX64 "has been successfully removed.\n", ChipLogValueX64(nodeId)); + fprintf(stderr, "Device with Node ID: " ChipLogFormatX64 " has been successfully removed.\n", ChipLogValueX64(nodeId)); + + if (self->mPairingDelegate) + { + self->mPairingDelegate->OnDeviceRemoved(nodeId, err); + self->SetPairingDelegate(nullptr); + } -#if defined(PW_RPC_ENABLED) FabricIndex fabricIndex = self->CurrentCommissioner().GetFabricIndex(); app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(fabricIndex, nodeId); ScopedNodeId scopedNodeId(nodeId, fabricIndex); - RemoveSynchronizedDevice(scopedNodeId); -#endif + DeviceManager::Instance().RemoveSyncedDevice(scopedNodeId); } else { @@ -655,3 +660,5 @@ CHIP_ERROR PairingManager::UnpairDevice(NodeId nodeId) } }); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/PairingManager.h b/examples/fabric-admin/device_manager/PairingManager.h index 50e64f9f0c..77cec24876 100644 --- a/examples/fabric-admin/device_manager/PairingManager.h +++ b/examples/fabric-admin/device_manager/PairingManager.h @@ -25,6 +25,8 @@ #include #include +namespace admin { + // Constants constexpr uint16_t kMaxManualCodeLength = 22; @@ -35,18 +37,12 @@ class CommissioningWindowDelegate virtual ~CommissioningWindowDelegate() = default; }; -class CommissioningDelegate -{ -public: - virtual void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) = 0; - virtual ~CommissioningDelegate() = default; -}; - class PairingDelegate { public: - virtual void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) = 0; - virtual ~PairingDelegate() = default; + virtual void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) {} + virtual void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) {} + virtual ~PairingDelegate() = default; }; /** @@ -83,7 +79,6 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, CHIP_ERROR Init(chip::Controller::DeviceCommissioner * commissioner, CredentialIssuerCommands * credIssuerCmds); void SetOpenCommissioningWindowDelegate(CommissioningWindowDelegate * delegate) { mCommissioningWindowDelegate = delegate; } - void SetCommissioningDelegate(CommissioningDelegate * delegate) { mCommissioningDelegate = delegate; } void SetPairingDelegate(PairingDelegate * delegate) { mPairingDelegate = delegate; } PairingDelegate * GetPairingDelegate() { return mPairingDelegate; } @@ -179,7 +174,6 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, CredentialIssuerCommands * mCredIssuerCmds = nullptr; CommissioningWindowDelegate * mCommissioningWindowDelegate = nullptr; - CommissioningDelegate * mCommissioningDelegate = nullptr; PairingDelegate * mPairingDelegate = nullptr; chip::NodeId mNodeId = chip::kUndefinedNodeId; @@ -214,3 +208,5 @@ class PairingManager : public chip::Controller::DevicePairingDelegate, chip::Platform::UniquePtr mCurrentFabricRemover; chip::Callback::Callback mCurrentFabricRemoveCallback; }; + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/UniqueIdGetter.cpp b/examples/fabric-admin/device_manager/UniqueIdGetter.cpp index 3a6d6af69d..cc3567deda 100644 --- a/examples/fabric-admin/device_manager/UniqueIdGetter.cpp +++ b/examples/fabric-admin/device_manager/UniqueIdGetter.cpp @@ -22,6 +22,8 @@ using namespace ::chip; using namespace ::chip::app; using chip::app::ReadClient; +namespace admin { + namespace { void OnDeviceConnectedWrapper(void * context, Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) @@ -139,3 +141,5 @@ void UniqueIdGetter::OnDeviceConnectionFailure(const ScopedNodeId & peerId, CHIP OnDone(nullptr); } + +} // namespace admin diff --git a/examples/fabric-admin/device_manager/UniqueIdGetter.h b/examples/fabric-admin/device_manager/UniqueIdGetter.h index 86d5d82f65..eba4451599 100644 --- a/examples/fabric-admin/device_manager/UniqueIdGetter.h +++ b/examples/fabric-admin/device_manager/UniqueIdGetter.h @@ -24,6 +24,8 @@ #include #include +namespace admin { + /** * @brief Class used to get UniqueID from Bridged Device Basic Information Cluster * @@ -73,3 +75,5 @@ class UniqueIdGetter : public chip::app::ReadClient::Callback char mUniqueId[33]; chip::EndpointId mEndpointId; }; + +} // namespace admin diff --git a/examples/fabric-admin/include/CHIPProjectAppConfig.h b/examples/fabric-admin/include/CHIPProjectAppConfig.h index b3f85d6935..441ecd788f 100644 --- a/examples/fabric-admin/include/CHIPProjectAppConfig.h +++ b/examples/fabric-admin/include/CHIPProjectAppConfig.h @@ -54,8 +54,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 1 // Enable some test-only interaction model APIs. diff --git a/examples/fabric-admin/main.cpp b/examples/fabric-admin/main.cpp index 5768abf496..5b7219a210 100644 --- a/examples/fabric-admin/main.cpp +++ b/examples/fabric-admin/main.cpp @@ -32,7 +32,7 @@ using namespace chip; void ApplicationInit() { - DeviceMgr().Init(); + admin::DeviceManager::Instance().Init(); } // ================================================================================ diff --git a/examples/fabric-admin/rpc/RpcClient.cpp b/examples/fabric-admin/rpc/RpcClient.cpp index 9964dc6767..f99d925d9d 100644 --- a/examples/fabric-admin/rpc/RpcClient.cpp +++ b/examples/fabric-admin/rpc/RpcClient.cpp @@ -28,6 +28,8 @@ using namespace chip; +namespace admin { + namespace { // Constants @@ -57,7 +59,7 @@ CHIP_ERROR WaitForResponse(CallType & call) } else { - fprintf(stderr, "RPC Response timed out!"); + fprintf(stderr, "RPC Response timed out!\n"); return CHIP_ERROR_TIMEOUT; } } @@ -227,3 +229,5 @@ CHIP_ERROR DeviceReachableChanged(const chip_rpc_ReachabilityChanged & data) return WaitForResponse(call); } + +} // namespace admin diff --git a/examples/fabric-admin/rpc/RpcClient.h b/examples/fabric-admin/rpc/RpcClient.h index a4cefe8bd8..642e263771 100644 --- a/examples/fabric-admin/rpc/RpcClient.h +++ b/examples/fabric-admin/rpc/RpcClient.h @@ -23,6 +23,8 @@ #include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" +namespace admin { + /** * @brief Sets the RPC server port to which the RPC client will connect. * @@ -99,3 +101,5 @@ CHIP_ERROR AdminCommissioningAttributeChanged(const chip_rpc_AdministratorCommis * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. */ CHIP_ERROR DeviceReachableChanged(const chip_rpc_ReachabilityChanged & data); + +} // namespace admin diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index e10bb64cdc..05fb949224 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -38,6 +38,8 @@ using namespace ::chip; +namespace admin { + namespace { #if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE @@ -110,9 +112,9 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate ChipLogValueX64(scopedNodeId.GetNodeId()), commissioningTimeoutSec, iterations, discriminator); // Open the device commissioning window using raw binary data for salt and verifier - DeviceMgr().OpenDeviceCommissioningWindow(scopedNodeId, iterations, commissioningTimeoutSec, discriminator, - ByteSpan(request.salt.bytes, request.salt.size), - ByteSpan(request.verifier.bytes, request.verifier.size)); + DeviceManager::Instance().OpenDeviceCommissioningWindow(scopedNodeId, iterations, commissioningTimeoutSec, discriminator, + ByteSpan(request.salt.bytes, request.salt.size), + ByteSpan(request.verifier.bytes, request.verifier.size)); response.success = true; @@ -144,13 +146,13 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate if (error == CHIP_NO_ERROR) { - NodeId nodeId = DeviceMgr().GetNextAvailableNodeId(); + NodeId nodeId = DeviceManager::Instance().GetNextAvailableNodeId(); // After responding with RequestCommissioningApproval to the node where the client initiated the // RequestCommissioningApproval, you need to wait for it to open a commissioning window on its bridge. usleep(kCommissionPrepareTimeMs * 1000); - DeviceMgr().PairRemoteDevice(nodeId, code.c_str()); + DeviceManager::Instance().PairRemoteDevice(nodeId, code.c_str()); } else { @@ -254,3 +256,5 @@ void InitRpcServer(uint16_t rpcServerPort) std::thread rpc_service(RunRpcService); rpc_service.detach(); } + +} // namespace admin diff --git a/examples/fabric-admin/rpc/RpcServer.h b/examples/fabric-admin/rpc/RpcServer.h index d283c0db5a..c8fcd33324 100644 --- a/examples/fabric-admin/rpc/RpcServer.h +++ b/examples/fabric-admin/rpc/RpcServer.h @@ -18,4 +18,8 @@ #pragma once +namespace admin { + void InitRpcServer(uint16_t rpcServerPort); + +} // namespace admin diff --git a/examples/fabric-admin/scripts/fabric-sync-app.py b/examples/fabric-admin/scripts/fabric-sync-app.py index bc26c655be..3de85b9f67 100755 --- a/examples/fabric-admin/scripts/fabric-sync-app.py +++ b/examples/fabric-admin/scripts/fabric-sync-app.py @@ -32,6 +32,7 @@ async def forward_f(prefix: bytes, f_in: asyncio.StreamReader, This function can optionally feed received lines to a callback function. """ + while line := await f_in.readline(): if cb is not None: cb(line) diff --git a/examples/fabric-admin/scripts/run_fabric_sync.sh b/examples/fabric-admin/scripts/run_fabric_sync.sh index 49182f7ce9..60e6f9554e 100755 --- a/examples/fabric-admin/scripts/run_fabric_sync.sh +++ b/examples/fabric-admin/scripts/run_fabric_sync.sh @@ -104,6 +104,11 @@ else exit 1 fi +# Remove previous log files +rm /tmp/fabric_admin.log +rm /tmp/fabric_bridge_app.log +echo "Removed fabric sync log files." + # Start fabric-bridge-app if available and redirect its output to /dev/null if [ -f "$FABRIC_BRIDGE_APP_PATH" ]; then "$FABRIC_BRIDGE_APP_PATH" >"$FABRIC_BRIDGE_APP_LOG" 2>&1 & diff --git a/examples/fabric-admin/scripts/stop_fabric_sync.sh b/examples/fabric-admin/scripts/stop_fabric_sync.sh index a03e188b5e..e9e44f4a5d 100755 --- a/examples/fabric-admin/scripts/stop_fabric_sync.sh +++ b/examples/fabric-admin/scripts/stop_fabric_sync.sh @@ -22,6 +22,3 @@ fi # Remove /tmp/chip_* files and directories rm -rf /tmp/chip_* echo "Removed /tmp/chip_* files and directories." -rm /tmp/fabric_admin.log -rm /tmp/fabric_bridge_app.log -echo "Removed fabric sync log files." diff --git a/examples/fabric-admin/with_pw_rpc.gni b/examples/fabric-admin/with_pw_rpc.gni index abb9ac65f2..d5e1aae432 100644 --- a/examples/fabric-admin/with_pw_rpc.gni +++ b/examples/fabric-admin/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -39,4 +39,3 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true -chip_use_pw_logging = true diff --git a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedAdministratorCommissioning.h b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedAdministratorCommissioning.h index 06fd9026d4..7b5711d395 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedAdministratorCommissioning.h +++ b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedAdministratorCommissioning.h @@ -20,6 +20,8 @@ #include #include +namespace bridge { + /** * @brief CADMIN cluster implementation for handling attribute interactions of bridged device endpoints. * @@ -56,3 +58,5 @@ class BridgedAdministratorCommissioning : public chip::app::AttributeAccessInter // to reflect this change. chip::app::AttributeAccessInterface * mOriginalAttributeInterface = nullptr; }; + +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDevice.h b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDevice.h index d2c5a64b9e..ed5c971062 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDevice.h +++ b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDevice.h @@ -23,6 +23,8 @@ #include +namespace bridge { + class BridgedDevice { public: @@ -90,3 +92,5 @@ class BridgedDevice BridgedAttributes mAttributes; AdminCommissioningAttributes mAdminCommissioningAttributes; }; + +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceBasicInformationImpl.h b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceBasicInformationImpl.h index 23403438ab..f57f7d0362 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceBasicInformationImpl.h +++ b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceBasicInformationImpl.h @@ -18,6 +18,8 @@ #include #include +namespace bridge { + class BridgedDeviceBasicInformationImpl : public chip::app::AttributeAccessInterface { public: @@ -30,3 +32,5 @@ class BridgedDeviceBasicInformationImpl : public chip::app::AttributeAccessInter CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath & path, chip::app::AttributeValueEncoder & encoder) override; CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath & path, chip::app::AttributeValueDecoder & decoder) override; }; + +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceManager.h b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceManager.h index 127898fc5b..d06c6fa4ae 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceManager.h +++ b/examples/fabric-bridge-app/fabric-bridge-common/include/BridgedDeviceManager.h @@ -24,11 +24,19 @@ #include +namespace bridge { + class BridgedDeviceManager { public: BridgedDeviceManager() = default; + static BridgedDeviceManager & Instance() + { + static BridgedDeviceManager instance; + return instance; + } + /** * @brief Initializes the BridgedDeviceManager. * @@ -110,8 +118,6 @@ class BridgedDeviceManager BridgedDevice * GetDeviceByUniqueId(const std::string & id); private: - friend BridgedDeviceManager & BridgeDeviceMgr(); - /** * Creates a new unique ID that is not used by any other mDevice */ @@ -124,13 +130,4 @@ class BridgedDeviceManager std::unique_ptr mDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT + 1]; }; -/** - * Returns the public interface of the BridgedDeviceManager singleton object. - * - * Applications should use this to access features of the BridgedDeviceManager - * object. - */ -inline BridgedDeviceManager & BridgeDeviceMgr() -{ - return BridgedDeviceManager::sInstance; -} +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedAdministratorCommissioning.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedAdministratorCommissioning.cpp index a0d87cbb3b..6cfb5a5caa 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedAdministratorCommissioning.cpp +++ b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedAdministratorCommissioning.cpp @@ -26,6 +26,8 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::AdministratorCommissioning; +namespace bridge { + CHIP_ERROR BridgedAdministratorCommissioning::Init() { // We expect initialization after emberAfInit(). This allows us to unregister the existing @@ -43,7 +45,7 @@ CHIP_ERROR BridgedAdministratorCommissioning::Read(const ConcreteReadAttributePa { VerifyOrDie(aPath.mClusterId == Clusters::AdministratorCommissioning::Id); EndpointId endpointId = aPath.mEndpointId; - BridgedDevice * device = BridgeDeviceMgr().GetDevice(endpointId); + BridgedDevice * device = BridgedDeviceManager::Instance().GetDevice(endpointId); if (!device) { @@ -79,3 +81,5 @@ CHIP_ERROR BridgedAdministratorCommissioning::Read(const ConcreteReadAttributePa return CHIP_NO_ERROR; } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp index f462d1cce6..bd88c89145 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp +++ b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDevice.cpp @@ -27,6 +27,8 @@ using namespace chip; using namespace chip::app::Clusters::Actions; +namespace bridge { + BridgedDevice::BridgedDevice(ScopedNodeId scopedNodeId) { mReachable = false; @@ -116,3 +118,5 @@ void BridgedDevice::SetAdminCommissioningAttributes(const AdminCommissioningAttr } }); } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceBasicInformationImpl.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceBasicInformationImpl.cpp index 7fa48a4a15..3a03d8f84a 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceBasicInformationImpl.cpp +++ b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceBasicInformationImpl.cpp @@ -29,12 +29,14 @@ using namespace ::chip; using namespace ::chip::app; using namespace ::chip::app::Clusters; +namespace bridge { + CHIP_ERROR BridgedDeviceBasicInformationImpl::Read(const ConcreteReadAttributePath & path, AttributeValueEncoder & encoder) { // Registration is done for the bridged device basic information only VerifyOrDie(path.mClusterId == app::Clusters::BridgedDeviceBasicInformation::Id); - BridgedDevice * dev = BridgeDeviceMgr().GetDevice(path.mEndpointId); + BridgedDevice * dev = BridgedDeviceManager::Instance().GetDevice(path.mEndpointId); VerifyOrReturnError(dev != nullptr, CHIP_ERROR_NOT_FOUND); switch (path.mAttributeId) @@ -91,7 +93,7 @@ CHIP_ERROR BridgedDeviceBasicInformationImpl::Write(const ConcreteDataAttributeP { VerifyOrDie(path.mClusterId == app::Clusters::BridgedDeviceBasicInformation::Id); - BridgedDevice * dev = BridgeDeviceMgr().GetDevice(path.mEndpointId); + BridgedDevice * dev = BridgedDeviceManager::Instance().GetDevice(path.mEndpointId); VerifyOrReturnError(dev != nullptr, CHIP_ERROR_NOT_FOUND); if (!dev->IsReachable()) @@ -105,3 +107,5 @@ CHIP_ERROR BridgedDeviceBasicInformationImpl::Write(const ConcreteDataAttributeP return CHIP_ERROR_INVALID_ARGUMENT; } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceManager.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceManager.cpp index 0265f91202..5c53d413cb 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceManager.cpp +++ b/examples/fabric-bridge-app/fabric-bridge-common/src/BridgedDeviceManager.cpp @@ -45,6 +45,8 @@ using namespace chip::Transport; using namespace chip::DeviceLayer; using namespace chip::app::Clusters; +namespace bridge { + namespace { constexpr uint8_t kMaxRetries = 10; @@ -174,9 +176,6 @@ const EmberAfDeviceType sBridgedDeviceTypes[] = { { DEVICE_TYPE_BRIDGED_NODE, DE } // namespace -// Define the static member -BridgedDeviceManager BridgedDeviceManager::sInstance; - void BridgedDeviceManager::Init() { mFirstDynamicEndpointId = static_cast( @@ -343,3 +342,5 @@ std::optional BridgedDeviceManager::RemoveDeviceByScopedNodeId(chip::S } return std::nullopt; } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index d0e92a408e..aec152497a 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -33,7 +33,7 @@ if (bridge_enable_pw_rpc) { executable("fabric-bridge-app") { sources = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h", - "CommissionerControl.cpp", + "CommissionerControlDelegate.cpp", "main.cpp", ] diff --git a/examples/fabric-bridge-app/linux/CommissionerControl.cpp b/examples/fabric-bridge-app/linux/CommissionerControlDelegate.cpp similarity index 94% rename from examples/fabric-bridge-app/linux/CommissionerControl.cpp rename to examples/fabric-bridge-app/linux/CommissionerControlDelegate.cpp index 138e1129b8..aa12a4274c 100644 --- a/examples/fabric-bridge-app/linux/CommissionerControl.cpp +++ b/examples/fabric-bridge-app/linux/CommissionerControlDelegate.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "CommissionerControl.h" +#include "CommissionerControlDelegate.h" #include "RpcClient.h" #include @@ -186,13 +186,13 @@ CHIP_ERROR CommissionerControlDelegate::HandleCommissionNode(const Commissioning VerifyOrReturnError(mNextStep == Step::kStartCommissionNode, CHIP_ERROR_INCORRECT_STATE); #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE - err = CommissionNode(Controller::CommissioningWindowPasscodeParams() - .SetSetupPIN(kSetupPinCode) - .SetTimeout(params.commissioningTimeout) - .SetDiscriminator(params.discriminator) - .SetIteration(params.iterations) - .SetSalt(params.salt), - mVendorId, mProductId); + err = bridge::CommissionNode(Controller::CommissioningWindowPasscodeParams() + .SetSetupPIN(kSetupPinCode) + .SetTimeout(params.commissioningTimeout) + .SetDiscriminator(params.discriminator) + .SetIteration(params.iterations) + .SetSalt(params.salt), + mVendorId, mProductId); #else ChipLogProgress(NotSpecified, "Failed to reverse commission bridge: PW_RPC_FABRIC_BRIDGE_SERVICE not defined"); err = CHIP_ERROR_NOT_IMPLEMENTED; @@ -209,6 +209,8 @@ CHIP_ERROR CommissionerControlDelegate::HandleCommissionNode(const Commissioning } // namespace app } // namespace chip +namespace bridge { + CHIP_ERROR CommissionerControlInit() { CHIP_ERROR err; @@ -262,3 +264,5 @@ CHIP_ERROR CommissionerControlShutdown() return CHIP_NO_ERROR; } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/README.md b/examples/fabric-bridge-app/linux/README.md index ede6ce2639..912bb32c01 100644 --- a/examples/fabric-bridge-app/linux/README.md +++ b/examples/fabric-bridge-app/linux/README.md @@ -100,13 +100,13 @@ defined: Pull Docker Images ``` - docker pull connectedhomeip/chip-build-vscode:latest + docker pull ghcr.io/project-chip/chip-build-crosscompile:90 ``` Run docker ``` - docker run -it -v ~/connectedhomeip:/var/connectedhomeip connectedhomeip/chip-build-vscode:latest /bin/bash + docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:90 /bin/bash ``` Build @@ -115,8 +115,6 @@ defined: cd /var/connectedhomeip git config --global --add safe.directory /var/connectedhomeip - git config --global --add safe.directory /var/connectedhomeip/third_party/pigweed/repo - git config --global --add safe.directory /var/connectedhomeip/examples/common/QRCode/repo ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ diff --git a/examples/fabric-bridge-app/linux/RpcClient.cpp b/examples/fabric-bridge-app/linux/RpcClient.cpp index 732fdf8aa1..ef41ae261d 100644 --- a/examples/fabric-bridge-app/linux/RpcClient.cpp +++ b/examples/fabric-bridge-app/linux/RpcClient.cpp @@ -35,6 +35,8 @@ using namespace chip; +namespace bridge { + namespace { // Constants @@ -205,3 +207,5 @@ CHIP_ERROR KeepActive(chip::ScopedNodeId scopedNodeId, uint32_t stayActiveDurati return WaitForResponse(call); } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/RpcServer.cpp b/examples/fabric-bridge-app/linux/RpcServer.cpp index 5fea43c6ef..e699c47410 100644 --- a/examples/fabric-bridge-app/linux/RpcServer.cpp +++ b/examples/fabric-bridge-app/linux/RpcServer.cpp @@ -37,6 +37,8 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; +namespace bridge { + namespace { #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE @@ -116,7 +118,7 @@ pw::Status FabricBridge::AddSynchronizedDevice(const chip_rpc_SynchronizedDevice device->SetBridgedAttributes(attributes); device->SetIcd(request.has_is_icd && request.is_icd); - auto result = BridgeDeviceMgr().AddDeviceEndpoint(std::move(device), 1 /* parentEndpointId */); + auto result = BridgedDeviceManager::Instance().AddDeviceEndpoint(std::move(device), 1 /* parentEndpointId */); if (!result.has_value()) { ChipLogError(NotSpecified, "Failed to add device with Id=[%d:0x" ChipLogFormatX64 "]", scopedNodeId.GetFabricIndex(), @@ -124,7 +126,7 @@ pw::Status FabricBridge::AddSynchronizedDevice(const chip_rpc_SynchronizedDevice return pw::Status::Unknown(); } - BridgedDevice * addedDevice = BridgeDeviceMgr().GetDeviceByScopedNodeId(scopedNodeId); + BridgedDevice * addedDevice = BridgedDeviceManager::Instance().GetDeviceByScopedNodeId(scopedNodeId); VerifyOrDie(addedDevice); CHIP_ERROR err = EcosystemInformation::EcosystemInformationServer::Instance().AddEcosystemInformationClusterToEndpoint( @@ -141,7 +143,7 @@ pw::Status FabricBridge::RemoveSynchronizedDevice(const chip_rpc_SynchronizedDev ChipLogProgress(NotSpecified, "Received RemoveSynchronizedDevice: Id=[%d:" ChipLogFormatX64 "]", scopedNodeId.GetFabricIndex(), ChipLogValueX64(scopedNodeId.GetNodeId())); - auto removed_idx = BridgeDeviceMgr().RemoveDeviceByScopedNodeId(scopedNodeId); + auto removed_idx = BridgedDeviceManager::Instance().RemoveDeviceByScopedNodeId(scopedNodeId); if (!removed_idx.has_value()) { ChipLogError(NotSpecified, "Failed to remove device with Id=[%d:0x" ChipLogFormatX64 "]", scopedNodeId.GetFabricIndex(), @@ -159,7 +161,7 @@ pw::Status FabricBridge::ActiveChanged(const chip_rpc_KeepActiveChanged & reques ChipLogProgress(NotSpecified, "Received ActiveChanged: Id=[%d:" ChipLogFormatX64 "]", scopedNodeId.GetFabricIndex(), ChipLogValueX64(scopedNodeId.GetNodeId())); - auto * device = BridgeDeviceMgr().GetDeviceByScopedNodeId(scopedNodeId); + auto * device = BridgedDeviceManager::Instance().GetDeviceByScopedNodeId(scopedNodeId); if (device == nullptr) { ChipLogError(NotSpecified, "Could not find bridged device associated with Id=[%d:0x" ChipLogFormatX64 "]", @@ -179,7 +181,7 @@ pw::Status FabricBridge::AdminCommissioningAttributeChanged(const chip_rpc_Admin ChipLogProgress(NotSpecified, "Received CADMIN attribute change: Id=[%d:" ChipLogFormatX64 "]", scopedNodeId.GetFabricIndex(), ChipLogValueX64(scopedNodeId.GetNodeId())); - auto * device = BridgeDeviceMgr().GetDeviceByScopedNodeId(scopedNodeId); + auto * device = BridgedDeviceManager::Instance().GetDeviceByScopedNodeId(scopedNodeId); if (device == nullptr) { ChipLogError(NotSpecified, "Could not find bridged device associated with Id=[%d:0x" ChipLogFormatX64 "]", @@ -218,7 +220,7 @@ pw::Status FabricBridge::DeviceReachableChanged(const chip_rpc_ReachabilityChang ChipLogProgress(NotSpecified, "Received device reachable changed: Id=[%d:" ChipLogFormatX64 "]", scopedNodeId.GetFabricIndex(), ChipLogValueX64(scopedNodeId.GetNodeId())); - auto * device = BridgeDeviceMgr().GetDeviceByScopedNodeId(scopedNodeId); + auto * device = BridgedDeviceManager::Instance().GetDeviceByScopedNodeId(scopedNodeId); if (device == nullptr) { ChipLogError(NotSpecified, "Could not find bridged device associated with Id=[%d:0x" ChipLogFormatX64 "]", @@ -256,3 +258,5 @@ void InitRpcServer(uint16_t rpcServerPort) std::thread rpc_service(RunRpcService); rpc_service.detach(); } + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/include/CommissionerControl.h b/examples/fabric-bridge-app/linux/include/CommissionerControlDelegate.h similarity index 98% rename from examples/fabric-bridge-app/linux/include/CommissionerControl.h rename to examples/fabric-bridge-app/linux/include/CommissionerControlDelegate.h index fceb80c2d8..2f9e15f508 100644 --- a/examples/fabric-bridge-app/linux/include/CommissionerControl.h +++ b/examples/fabric-bridge-app/linux/include/CommissionerControlDelegate.h @@ -89,5 +89,9 @@ class CommissionerControlDelegate : public Delegate } // namespace app } // namespace chip +namespace bridge { + CHIP_ERROR CommissionerControlInit(); CHIP_ERROR CommissionerControlShutdown(); + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/include/RpcClient.h b/examples/fabric-bridge-app/linux/include/RpcClient.h index 1ede84ff44..9a06686f06 100644 --- a/examples/fabric-bridge-app/linux/include/RpcClient.h +++ b/examples/fabric-bridge-app/linux/include/RpcClient.h @@ -22,6 +22,8 @@ #include #include +namespace bridge { + /** * Sets the RPC server port to which the RPC client will connect. * @@ -70,3 +72,5 @@ CHIP_ERROR CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params, chip::VendorId vendorId, uint16_t productId); CHIP_ERROR KeepActive(chip::ScopedNodeId scopedNodeId, uint32_t stayActiveDurationMs, uint32_t timeoutMs); + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/include/RpcServer.h b/examples/fabric-bridge-app/linux/include/RpcServer.h index d283c0db5a..ab0626c866 100644 --- a/examples/fabric-bridge-app/linux/include/RpcServer.h +++ b/examples/fabric-bridge-app/linux/include/RpcServer.h @@ -18,4 +18,8 @@ #pragma once +namespace bridge { + void InitRpcServer(uint16_t rpcServerPort); + +} // namespace bridge diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index a101fd3d32..8c622cac54 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -23,7 +23,7 @@ #include "BridgedDeviceBasicInformationImpl.h" #include "BridgedDeviceManager.h" #include "CommissionableInit.h" -#include "CommissionerControl.h" +#include "CommissionerControlDelegate.h" #include #include @@ -35,6 +35,12 @@ #include "RpcServer.h" #endif +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::AdministratorCommissioning; +using namespace chip::app::Clusters::BridgedDeviceBasicInformation; + // This is declared here and not in a header because zap/embr assumes all clusters // are defined in a static endpoint in the .zap file. From there, the codegen will // automatically use PluginApplicationCallbacksHeader.jinja to declare and call @@ -43,12 +49,6 @@ // need to declare and call it ourselves where the application is initialized. void MatterEcosystemInformationPluginServerInitCallback(); -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::AdministratorCommissioning; -using namespace chip::app::Clusters::BridgedDeviceBasicInformation; - namespace { #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE @@ -58,8 +58,6 @@ constexpr uint16_t kRetryIntervalS = 3; uint16_t gFabricAdminServerPort = 33001; uint16_t gLocalServerPort = 33002; -BridgedDeviceBasicInformationImpl gBridgedDeviceBasicInformationAttributes; - constexpr uint16_t kOptionFabricAdminServerPortNumber = 0xFF01; constexpr uint16_t kOptionLocalServerPortNumber = 0xFF02; @@ -100,7 +98,7 @@ ArgParser::OptionSet sProgramCustomOptions = { HandleCustomOption, sProgramCusto #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) { - if (StartRpcClient() == CHIP_NO_ERROR) + if (bridge::StartRpcClient() == CHIP_NO_ERROR) { ChipLogProgress(NotSpecified, "Connected to Fabric-Admin"); } @@ -112,6 +110,10 @@ void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) } #endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +} // namespace + +namespace bridge { + class AdministratorCommissioningCommandHandler : public CommandHandlerInterface { public: @@ -149,7 +151,7 @@ void AdministratorCommissioningCommandHandler::InvokeCommand(HandlerContext & ha Status status = Status::Failure; #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE - BridgedDevice * device = BridgeDeviceMgr().GetDevice(endpointId); + BridgedDevice * device = BridgedDeviceManager::Instance().GetDevice(endpointId); // TODO: issues:#33784, need to make OpenCommissioningWindow synchronous if (device != nullptr && @@ -212,7 +214,7 @@ void BridgedDeviceInformationCommandHandler::InvokeCommand(HandlerContext & hand return; } - BridgedDevice * device = BridgeDeviceMgr().GetDevice(endpointId); + BridgedDevice * device = BridgedDeviceManager::Instance().GetDevice(endpointId); if (device == nullptr || !device->IsIcd()) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::Failure); @@ -239,30 +241,31 @@ void BridgedDeviceInformationCommandHandler::InvokeCommand(HandlerContext & hand } BridgedAdministratorCommissioning gBridgedAdministratorCommissioning; +BridgedDeviceBasicInformationImpl gBridgedDeviceBasicInformationAttributes; AdministratorCommissioningCommandHandler gAdministratorCommissioningCommandHandler; BridgedDeviceInformationCommandHandler gBridgedDeviceInformationCommandHandler; -} // namespace +} // namespace bridge void ApplicationInit() { ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationInit()"); MatterEcosystemInformationPluginServerInitCallback(); - CommandHandlerInterfaceRegistry::Instance().RegisterCommandHandler(&gAdministratorCommissioningCommandHandler); - CommandHandlerInterfaceRegistry::Instance().RegisterCommandHandler(&gBridgedDeviceInformationCommandHandler); - AttributeAccessInterfaceRegistry::Instance().Register(&gBridgedDeviceBasicInformationAttributes); + CommandHandlerInterfaceRegistry::Instance().RegisterCommandHandler(&bridge::gAdministratorCommissioningCommandHandler); + CommandHandlerInterfaceRegistry::Instance().RegisterCommandHandler(&bridge::gBridgedDeviceInformationCommandHandler); + AttributeAccessInterfaceRegistry::Instance().Register(&bridge::gBridgedDeviceBasicInformationAttributes); #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE - SetRpcRemoteServerPort(gFabricAdminServerPort); - InitRpcServer(gLocalServerPort); + bridge::SetRpcRemoteServerPort(gFabricAdminServerPort); + bridge::InitRpcServer(gLocalServerPort); AttemptRpcClientConnect(&DeviceLayer::SystemLayer(), nullptr); #endif - BridgeDeviceMgr().Init(); - VerifyOrDie(gBridgedAdministratorCommissioning.Init() == CHIP_NO_ERROR); + bridge::BridgedDeviceManager::Instance().Init(); + VerifyOrDie(bridge::gBridgedAdministratorCommissioning.Init() == CHIP_NO_ERROR); - VerifyOrDieWithMsg(CommissionerControlInit() == CHIP_NO_ERROR, NotSpecified, + VerifyOrDieWithMsg(bridge::CommissionerControlInit() == CHIP_NO_ERROR, NotSpecified, "Failed to initialize Commissioner Control Server"); } @@ -270,7 +273,7 @@ void ApplicationShutdown() { ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationShutdown()"); - if (CommissionerControlShutdown() != CHIP_NO_ERROR) + if (bridge::CommissionerControlShutdown() != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Failed to shutdown Commissioner Control Server"); } diff --git a/examples/fabric-bridge-app/linux/with_pw_rpc.gni b/examples/fabric-bridge-app/linux/with_pw_rpc.gni index e1bd567cf2..335a1f3096 100644 --- a/examples/fabric-bridge-app/linux/with_pw_rpc.gni +++ b/examples/fabric-bridge-app/linux/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -38,5 +38,4 @@ pw_build_LINK_DEPS = [ "$dir_pw_log:impl", ] -chip_use_pw_logging = true bridge_enable_pw_rpc = true diff --git a/examples/fabric-sync/BUILD.gn b/examples/fabric-sync/BUILD.gn index de193bd5f6..95b0ce3c60 100644 --- a/examples/fabric-sync/BUILD.gn +++ b/examples/fabric-sync/BUILD.gn @@ -22,21 +22,35 @@ assert(chip_build_tools) executable("fabric-sync") { cflags = [ "-Wconversion" ] + defines = [] + + if (chip_build_libshell) { + defines += [ "ENABLE_CHIP_SHELL" ] + } + include_dirs = [ ".", "${chip_root}/src/lib", ] + if (chip_build_libshell) { + include_dirs += [ "shell" ] + } + sources = [ "main.cpp" ] deps = [ + "${chip_root}/examples/fabric-sync/admin:fabric-admin-lib", "${chip_root}/examples/fabric-sync/bridge:fabric-bridge-lib", - "${chip_root}/examples/fabric-sync/bridge:fabric-bridge-zap", "${chip_root}/examples/platform/linux:app-main", "${chip_root}/src/lib", "${chip_root}/third_party/inipp", ] + if (chip_build_libshell) { + deps += [ "${chip_root}/examples/fabric-sync/shell" ] + } + output_dir = root_out_dir } diff --git a/examples/fabric-sync/README.md b/examples/fabric-sync/README.md index 6cbe9da9e9..0fd4735c74 100644 --- a/examples/fabric-sync/README.md +++ b/examples/fabric-sync/README.md @@ -92,13 +92,13 @@ defined: Pull Docker Images ``` - docker pull connectedhomeip/chip-build-vscode:latest + docker pull ghcr.io/project-chip/chip-build-crosscompile:90 ``` Run docker ``` - docker run -it -v ~/connectedhomeip:/var/connectedhomeip connectedhomeip/chip-build-vscode:latest /bin/bash + docker run -it -v ~/connectedhomeip:/var/connectedhomeip ghcr.io/project-chip/chip-build-crosscompile:90 /bin/bash ``` Build @@ -107,8 +107,6 @@ defined: cd /var/connectedhomeip git config --global --add safe.directory /var/connectedhomeip - git config --global --add safe.directory /var/connectedhomeip/third_party/pigweed/repo - git config --global --add safe.directory /var/connectedhomeip/examples/common/QRCode/repo ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ diff --git a/src/app/ember_coupling/BUILD.gn b/examples/fabric-sync/admin/BUILD.gn similarity index 66% rename from src/app/ember_coupling/BUILD.gn rename to examples/fabric-sync/admin/BUILD.gn index 422fc8bef7..c2ab715230 100644 --- a/src/app/ember_coupling/BUILD.gn +++ b/examples/fabric-sync/admin/BUILD.gn @@ -13,11 +13,18 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("${chip_root}/src/app/chip_data_model.gni") -# The sources in this directory exist to limit the amount of code duplication -# and assume strong ember and access coupling -# -# They are NOT stand-alone compilable and are rather for `#include` support. -source_set("ember_coupling") { - sources = [ "EventPathValidity.mixin.h" ] +source_set("fabric-admin-lib") { + sources = [ + "DeviceManager.cpp", + "DeviceManager.h", + "PairingManager.cpp", + "PairingManager.h", + ] + + deps = [ + "${chip_root}/examples/fabric-sync/bridge:fabric-bridge-lib", + "${chip_root}/src/lib", + ] } diff --git a/examples/fabric-sync/admin/DeviceManager.cpp b/examples/fabric-sync/admin/DeviceManager.cpp new file mode 100644 index 0000000000..76863e6a33 --- /dev/null +++ b/examples/fabric-sync/admin/DeviceManager.cpp @@ -0,0 +1,140 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "DeviceManager.h" + +#include +#include + +#include +#include + +using namespace chip; + +namespace admin { +// Define the static member +DeviceManager DeviceManager::sInstance; + +void DeviceManager::Init() +{ + // TODO: (#34113) Init mLastUsedNodeId from chip config file + mLastUsedNodeId = 1; + mInitialized = true; + + ChipLogProgress(NotSpecified, "DeviceManager initialized: last used nodeId " ChipLogFormatX64, + ChipLogValueX64(mLastUsedNodeId)); +} + +NodeId DeviceManager::GetNextAvailableNodeId() +{ + mLastUsedNodeId++; + VerifyOrDieWithMsg(mLastUsedNodeId < std::numeric_limits::max(), NotSpecified, "No more available NodeIds."); + + return mLastUsedNodeId; +} + +void DeviceManager::UpdateLastUsedNodeId(NodeId nodeId) +{ + if (nodeId > mLastUsedNodeId) + { + mLastUsedNodeId = nodeId; + ChipLogProgress(NotSpecified, "Updating last used NodeId to " ChipLogFormatX64, ChipLogValueX64(mLastUsedNodeId)); + } +} + +void DeviceManager::SetRemoteBridgeNodeId(chip::NodeId nodeId) +{ + mRemoteBridgeNodeId = nodeId; +} + +CHIP_ERROR DeviceManager::PairRemoteFabricBridge(NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, + uint16_t deviceRemotePort) +{ + CHIP_ERROR err = PairingManager::Instance().PairDevice(nodeId, setupPINCode, deviceRemoteIp, deviceRemotePort); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, + "Failed to pair remote fabric bridge: Node ID " ChipLogFormatX64 " with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(nodeId), err.Format()); + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceManager::PairRemoteDevice(NodeId nodeId, const char * payload) +{ + CHIP_ERROR err = PairingManager::Instance().PairDeviceWithCode(nodeId, payload); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair device: Node ID " ChipLogFormatX64 " with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(nodeId), err.Format()); + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceManager::PairRemoteDevice(NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, + uint16_t deviceRemotePort) +{ + CHIP_ERROR err = PairingManager::Instance().PairDevice(nodeId, setupPINCode, deviceRemoteIp, deviceRemotePort); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair device: Node ID " ChipLogFormatX64 " with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(nodeId), err.Format()); + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceManager::UnpairRemoteFabricBridge() +{ + if (mRemoteBridgeNodeId == kUndefinedNodeId) + { + ChipLogError(NotSpecified, "Remote bridge node ID is undefined; cannot unpair device."); + return CHIP_ERROR_INCORRECT_STATE; + } + + CHIP_ERROR err = PairingManager::Instance().UnpairDevice(mRemoteBridgeNodeId); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to unpair remote bridge device " ChipLogFormatX64, ChipLogValueX64(mRemoteBridgeNodeId)); + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceManager::UnpairRemoteDevice(NodeId nodeId) +{ + CHIP_ERROR err = PairingManager::Instance().UnpairDevice(nodeId); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to unpair remote device " ChipLogFormatX64, ChipLogValueX64(nodeId)); + return err; + } + + return CHIP_NO_ERROR; +} + +} // namespace admin diff --git a/examples/fabric-sync/admin/DeviceManager.h b/examples/fabric-sync/admin/DeviceManager.h new file mode 100644 index 0000000000..db6ad9b528 --- /dev/null +++ b/examples/fabric-sync/admin/DeviceManager.h @@ -0,0 +1,148 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "PairingManager.h" + +#include +#include + +namespace admin { + +class DeviceManager +{ +public: + DeviceManager() = default; + + void Init(); + + chip::NodeId GetNextAvailableNodeId(); + + chip::NodeId GetRemoteBridgeNodeId() const { return mRemoteBridgeNodeId; } + + void UpdateLastUsedNodeId(chip::NodeId nodeId); + + void SetRemoteBridgeNodeId(chip::NodeId nodeId); + + bool IsFabricSyncReady() const { return mRemoteBridgeNodeId != chip::kUndefinedNodeId; } + + /** + * @brief Determines whether a given nodeId corresponds to the remote bridge device. + * + * @param nodeId The ID of the node being checked. + * + * @return true if the nodeId matches the remote bridge device; otherwise, false. + */ + bool IsCurrentBridgeDevice(chip::NodeId nodeId) const { return nodeId == mRemoteBridgeNodeId; } + + /** + * @brief Pair a remote fabric bridge with a given node ID. + * + * This function initiates the pairing process for a remote fabric bridge using the specified parameters. + + * @param nodeId The user-defined ID for the node being commissioned. It doesn’t need to be the same ID, + * as for the first fabric. + * @param setupPINCode The setup PIN code used to authenticate the pairing process. + * @param deviceRemoteIp The IP address of the remote device that is being paired as part of the fabric bridge. + * @param deviceRemotePort The secured device port of the remote device that is being paired as part of the fabric bridge. + * + * @return CHIP_ERROR Returns CHIP_NO_ERROR on success or an appropriate error code on failure. + */ + CHIP_ERROR PairRemoteFabricBridge(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, + uint16_t deviceRemotePort); + + /** + * @brief Pair a remote Matter device to the current fabric. + * + * This function initiates the pairing process for a remote device using the specified parameters. + + * @param nodeId The user-defined ID for the node being commissioned. It doesn’t need to be the same ID, + * as for the first fabric. + * @param payload The the QR code payload or a manual pairing code generated by the first commissioner + * instance when opened commissioning window. + * + * @return CHIP_ERROR Returns CHIP_NO_ERROR on success or an appropriate error code on failure. + */ + CHIP_ERROR PairRemoteDevice(chip::NodeId nodeId, const char * payload); + + /** + * @brief Pair a remote Matter device to the current fabric. + * + * This function initiates the pairing process for a remote device using the specified parameters. + + * @param nodeId The user-defined ID for the node being commissioned. It doesn’t need to be the same ID, + * as for the first fabric. + * @param setupPINCode The setup PIN code used to authenticate the pairing process. + * @param deviceRemoteIp The IP address of the remote device that is being paired as part of the fabric bridge. + * @param deviceRemotePort The secured device port of the remote device that is being paired as part of the fabric bridge. + * + * @return CHIP_ERROR Returns CHIP_NO_ERROR on success or an appropriate error code on failure. + */ + CHIP_ERROR PairRemoteDevice(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, uint16_t deviceRemotePort); + + /** + * @brief Unpair the remote Matter fabric bridge. + * + * This function initiates the unpairing process for the remote Matter fabric bridge from the current fabric. + * + * @return CHIP_ERROR Returns CHIP_NO_ERROR on success or an appropriate error code on failure. + */ + CHIP_ERROR UnpairRemoteFabricBridge(); + + /** + * @brief Unpair a specific remote Matter device from the current fabric. + * + * This function removes a specific remote device, identified by the node ID, from the fabric. + * + * @param nodeId The user-defined ID of the node that is being unpaired. + * + * @return CHIP_ERROR Returns CHIP_NO_ERROR on success or an appropriate error code on failure. + */ + CHIP_ERROR UnpairRemoteDevice(chip::NodeId nodeId); + +private: + friend DeviceManager & DeviceMgr(); + + static DeviceManager sInstance; + + chip::NodeId mLastUsedNodeId = 0; + + // The Node ID of the remote bridge used for Fabric-Sync + // This represents the bridge on the other ecosystem. + chip::NodeId mRemoteBridgeNodeId = chip::kUndefinedNodeId; + + bool mInitialized = false; +}; + +/** + * Returns the public interface of the DeviceManager singleton object. + * + * Applications should use this to access features of the DeviceManager + * object. + */ +inline DeviceManager & DeviceMgr() +{ + if (!DeviceManager::sInstance.mInitialized) + { + DeviceManager::sInstance.Init(); + } + return DeviceManager::sInstance; +} + +} // namespace admin diff --git a/examples/fabric-sync/admin/PairingManager.cpp b/examples/fabric-sync/admin/PairingManager.cpp new file mode 100644 index 0000000000..a3f4af43da --- /dev/null +++ b/examples/fabric-sync/admin/PairingManager.cpp @@ -0,0 +1,562 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "PairingManager.h" + +#include +#include +#include + +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::Controller; + +namespace admin { + +namespace { + +CHIP_ERROR GetPayload(const char * setUpCode, SetupPayload & payload) +{ + VerifyOrReturnValue(setUpCode, CHIP_ERROR_INVALID_ARGUMENT); + bool isQRCode = strncmp(setUpCode, kQRCodePrefix, strlen(kQRCodePrefix)) == 0; + if (isQRCode) + { + ReturnErrorOnFailure(QRCodeSetupPayloadParser(setUpCode).populatePayload(payload)); + VerifyOrReturnError(payload.isValidQRCodePayload(), CHIP_ERROR_INVALID_ARGUMENT); + } + else + { + ReturnErrorOnFailure(ManualSetupPayloadParser(setUpCode).populatePayload(payload)); + VerifyOrReturnError(payload.isValidManualCode(), CHIP_ERROR_INVALID_ARGUMENT); + } + + return CHIP_NO_ERROR; +} + +bool ParseAddressWithInterface(const char * addressString, Inet::IPAddress & address, Inet::InterfaceId & interfaceId) +{ + struct addrinfo hints; + struct addrinfo * result; + int ret; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + ret = getaddrinfo(addressString, nullptr, &hints, &result); + if (ret < 0) + { + ChipLogError(NotSpecified, "Invalid address: %s", addressString); + return false; + } + + if (result->ai_family == AF_INET6) + { + struct sockaddr_in6 * addr = reinterpret_cast(result->ai_addr); + address = Inet::IPAddress::FromSockAddr(*addr); + interfaceId = Inet::InterfaceId(addr->sin6_scope_id); + } +#if INET_CONFIG_ENABLE_IPV4 + else if (result->ai_family == AF_INET) + { + address = Inet::IPAddress::FromSockAddr(*reinterpret_cast(result->ai_addr)); + interfaceId = Inet::InterfaceId::Null(); + } +#endif // INET_CONFIG_ENABLE_IPV4 + else + { + ChipLogError(NotSpecified, "Unsupported address: %s", addressString); + freeaddrinfo(result); + return false; + } + + freeaddrinfo(result); + return true; +} + +} // namespace + +PairingManager::PairingManager() : + mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this), + mOnOpenCommissioningWindowVerifierCallback(OnOpenCommissioningWindowVerifierResponse, this), + mCurrentFabricRemoveCallback(OnCurrentFabricRemove, this) +{} + +CHIP_ERROR PairingManager::Init(Controller::DeviceCommissioner * commissioner) +{ + VerifyOrReturnError(commissioner != nullptr, CHIP_ERROR_INCORRECT_STATE); + + mCommissioner = commissioner; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PairingManager::OpenCommissioningWindow(NodeId nodeId, EndpointId endpointId, uint16_t commissioningTimeoutSec, + uint32_t iterations, uint16_t discriminator, const ByteSpan & salt, + const ByteSpan & verifier) +{ + if (mCommissioner == nullptr) + { + ChipLogError(NotSpecified, "Commissioner is null, cannot open commissioning window"); + return CHIP_ERROR_INCORRECT_STATE; + } + + // Check if a window is already open + if (mWindowOpener != nullptr) + { + ChipLogError(NotSpecified, "A commissioning window is already open"); + return CHIP_ERROR_INCORRECT_STATE; + } + + // Ensure salt and verifier sizes are valid + if (!salt.empty() && salt.size() > chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length) + { + ChipLogError(NotSpecified, "Salt size exceeds buffer capacity"); + return CHIP_ERROR_BUFFER_TOO_SMALL; + } + + if (!verifier.empty() && verifier.size() > chip::Crypto::kSpake2p_VerifierSerialized_Length) + { + ChipLogError(NotSpecified, "Verifier size exceeds buffer capacity"); + return CHIP_ERROR_BUFFER_TOO_SMALL; + } + + if (!salt.empty()) + { + memcpy(mSaltBuffer, salt.data(), salt.size()); + mSalt = ByteSpan(mSaltBuffer, salt.size()); + } + else + { + mSalt = ByteSpan(); + } + + if (!verifier.empty()) + { + memcpy(mVerifierBuffer, verifier.data(), verifier.size()); + mVerifier = ByteSpan(mVerifierBuffer, verifier.size()); + } + else + { + mVerifier = ByteSpan(); + } + + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId, endpointId, commissioningTimeoutSec, iterations, discriminator]() { + PairingManager & self = PairingManager::Instance(); + + if (self.mCommissioner == nullptr) + { + ChipLogError(NotSpecified, "Commissioner is null, cannot open commissioning window"); + return; + } + + self.mWindowOpener = Platform::MakeUnique(self.mCommissioner); + + if (!self.mVerifier.empty()) + { + if (self.mSalt.empty()) + { + ChipLogError(NotSpecified, "Salt is required when verifier is set"); + self.mWindowOpener.reset(); + return; + } + + // Open the commissioning window with verifier parameters + CHIP_ERROR err = + self.mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(nodeId) + .SetEndpointId(endpointId) + .SetTimeout(commissioningTimeoutSec) + .SetIteration(iterations) + .SetDiscriminator(discriminator) + .SetVerifier(self.mVerifier) + .SetSalt(self.mSalt) + .SetCallback(&self.mOnOpenCommissioningWindowVerifierCallback)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to open commissioning window with verifier: %s", ErrorStr(err)); + self.mWindowOpener.reset(); + } + } + else + { + SetupPayload ignored; + // Open the commissioning window with passcode parameters + CHIP_ERROR err = self.mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(nodeId) + .SetEndpointId(endpointId) + .SetTimeout(commissioningTimeoutSec) + .SetIteration(iterations) + .SetDiscriminator(discriminator) + .SetSetupPIN(NullOptional) + .SetSalt(NullOptional) + .SetCallback(&self.mOnOpenCommissioningWindowCallback), + ignored); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to open commissioning window with passcode: %s", ErrorStr(err)); + self.mWindowOpener.reset(); + } + } + }); +} + +void PairingManager::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, SetupPayload payload) +{ + VerifyOrDie(context != nullptr); + PairingManager * self = static_cast(context); + if (self->mCommissioningWindowDelegate) + { + self->mCommissioningWindowDelegate->OnCommissioningWindowOpened(remoteId, err, payload); + self->SetOpenCommissioningWindowDelegate(nullptr); + } + + OnOpenCommissioningWindowVerifierResponse(context, remoteId, err); +} + +void PairingManager::OnOpenCommissioningWindowVerifierResponse(void * context, NodeId remoteId, CHIP_ERROR err) +{ + VerifyOrDie(context != nullptr); + PairingManager * self = static_cast(context); + LogErrorOnFailure(err); + + // Reset the window opener once the window operation is complete + self->mWindowOpener.reset(); +} + +void PairingManager::OnStatusUpdate(DevicePairingDelegate::Status status) +{ + switch (status) + { + case DevicePairingDelegate::Status::SecurePairingSuccess: + ChipLogProgress(NotSpecified, "CASE establishment successful"); + break; + case DevicePairingDelegate::Status::SecurePairingFailed: + ChipLogError(NotSpecified, "Secure Pairing Failed"); + break; + } +} + +void PairingManager::OnPairingComplete(CHIP_ERROR err) +{ + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "PASE establishment successful"); + } + else + { + ChipLogProgress(NotSpecified, "Pairing Failure: %s", ErrorStr(err)); + } +} + +void PairingManager::OnPairingDeleted(CHIP_ERROR err) +{ + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Pairing Deleted Success"); + } + else + { + ChipLogProgress(NotSpecified, "Pairing Deleted Failure: %s", ErrorStr(err)); + } +} + +void PairingManager::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) +{ + if (err == CHIP_NO_ERROR) + { + // print to console + fprintf(stderr, "New device with Node ID: " ChipLogFormatX64 " has been successfully added.\n", ChipLogValueX64(nodeId)); + } + else + { + ChipLogProgress(NotSpecified, "Device commissioning Failure: %s", ErrorStr(err)); + } + + if (mPairingDelegate) + { + mPairingDelegate->OnCommissioningComplete(nodeId, err); + SetPairingDelegate(nullptr); + } +} + +void PairingManager::OnReadCommissioningInfo(const Controller::ReadCommissioningInfo & info) +{ + ChipLogProgress(AppServer, "OnReadCommissioningInfo - vendorId=0x%04X productId=0x%04X", info.basic.vendorId, + info.basic.productId); + + // The string in CharSpan received from the device is not null-terminated, we use std::string here for coping and + // appending a null-terminator at the end of the string. + std::string userActiveModeTriggerInstruction; + + // Note: the callback doesn't own the buffer, should make a copy if it will be used it later. + if (info.icd.userActiveModeTriggerInstruction.size() != 0) + { + userActiveModeTriggerInstruction = + std::string(info.icd.userActiveModeTriggerInstruction.data(), info.icd.userActiveModeTriggerInstruction.size()); + } + + if (info.icd.userActiveModeTriggerHint.HasAny()) + { + ChipLogProgress(AppServer, "OnReadCommissioningInfo - LIT UserActiveModeTriggerHint=0x%08x", + info.icd.userActiveModeTriggerHint.Raw()); + ChipLogProgress(AppServer, "OnReadCommissioningInfo - LIT UserActiveModeTriggerInstruction=%s", + userActiveModeTriggerInstruction.c_str()); + } + ChipLogProgress(AppServer, "OnReadCommissioningInfo ICD - IdleModeDuration=%u activeModeDuration=%u activeModeThreshold=%u", + info.icd.idleModeDuration, info.icd.activeModeDuration, info.icd.activeModeThreshold); +} + +void PairingManager::OnDiscoveredDevice(const Dnssd::CommissionNodeData & nodeData) +{ + // Ignore nodes with closed commissioning window + VerifyOrReturn(nodeData.commissioningMode != 0); + + auto & resolutionData = nodeData; + + const uint16_t port = resolutionData.port; + char buf[Inet::IPAddress::kMaxStringLength]; + resolutionData.ipAddress[0].ToString(buf); + ChipLogProgress(NotSpecified, "Discovered Device: %s:%u", buf, port); + + // Stop Mdns discovery. + auto err = mCommissioner->StopCommissionableDiscovery(); + + // Some platforms does not implement a mechanism to stop mdns browse, so + // we just ignore CHIP_ERROR_NOT_IMPLEMENTED instead of bailing out. + if (CHIP_NO_ERROR != err && CHIP_ERROR_NOT_IMPLEMENTED != err) + { + return; + } + + mCommissioner->RegisterDeviceDiscoveryDelegate(nullptr); + + auto interfaceId = resolutionData.ipAddress[0].IsIPv6LinkLocal() ? resolutionData.interfaceId : Inet::InterfaceId::Null(); + auto peerAddress = Transport::PeerAddress::UDP(resolutionData.ipAddress[0], port, interfaceId); + err = Pair(mNodeId, peerAddress); + if (CHIP_NO_ERROR != err) + { + ChipLogProgress(NotSpecified, "Failed to pair device: " ChipLogFormatX64 " %s", ChipLogValueX64(mNodeId), ErrorStr(err)); + } +} + +Optional PairingManager::FailSafeExpiryTimeoutSecs() const +{ + // No manual input, so do not need to extend. + return Optional(); +} + +bool PairingManager::ShouldWaitAfterDeviceAttestation() +{ + // If there is a vendor ID and product ID, request OnDeviceAttestationCompleted(). + // Currently this is added in the case that the example is performing reverse commissioning, + // but it would be an improvement to store that explicitly. + // TODO: Issue #35297 - [Fabric Sync] Improve where we get VID and PID when validating CCTRL CommissionNode command + SetupPayload payload; + CHIP_ERROR err = GetPayload(mOnboardingPayload, payload); + return err == CHIP_NO_ERROR && (payload.vendorID != 0 || payload.productID != 0); +} + +void PairingManager::OnDeviceAttestationCompleted(Controller::DeviceCommissioner * deviceCommissioner, DeviceProxy * device, + const Credentials::DeviceAttestationVerifier::AttestationDeviceInfo & info, + Credentials::AttestationVerificationResult attestationResult) +{ + SetupPayload payload; + CHIP_ERROR parse_error = GetPayload(mOnboardingPayload, payload); + if (parse_error == CHIP_NO_ERROR && (payload.vendorID != 0 || payload.productID != 0)) + { + if (payload.vendorID == 0 || payload.productID == 0) + { + ChipLogProgress(NotSpecified, + "Failed validation: vendorID or productID must not be 0." + "Requested VID: %u, Requested PID: %u.", + payload.vendorID, payload.productID); + deviceCommissioner->ContinueCommissioningAfterDeviceAttestation( + device, Credentials::AttestationVerificationResult::kInvalidArgument); + return; + } + + if (payload.vendorID != info.BasicInformationVendorId() || payload.productID != info.BasicInformationProductId()) + { + ChipLogProgress(NotSpecified, + "Failed validation of vendorID or productID." + "Requested VID: %u, Requested PID: %u," + "Detected VID: %u, Detected PID %u.", + payload.vendorID, payload.productID, info.BasicInformationVendorId(), info.BasicInformationProductId()); + deviceCommissioner->ContinueCommissioningAfterDeviceAttestation( + device, + payload.vendorID == info.BasicInformationVendorId() + ? Credentials::AttestationVerificationResult::kDacProductIdMismatch + : Credentials::AttestationVerificationResult::kDacVendorIdMismatch); + return; + } + + // NOTE: This will log errors even if the attestion was successful. + CHIP_ERROR err = deviceCommissioner->ContinueCommissioningAfterDeviceAttestation(device, attestationResult); + if (CHIP_NO_ERROR != err) + { + ChipLogError(NotSpecified, "Failed to continue commissioning after device attestation, error: %s", ErrorStr(err)); + } + return; + } + + // Don't bypass attestation, continue with error. + CHIP_ERROR err = deviceCommissioner->ContinueCommissioningAfterDeviceAttestation(device, attestationResult); + if (CHIP_NO_ERROR != err) + { + ChipLogError(NotSpecified, "Failed to continue commissioning after device attestation, error: %s", ErrorStr(err)); + } +} + +CommissioningParameters PairingManager::GetCommissioningParameters() +{ + auto params = CommissioningParameters(); + params.SetSkipCommissioningComplete(false); + params.SetDeviceAttestationDelegate(this); + + return params; +} + +CHIP_ERROR PairingManager::Pair(NodeId remoteId, Transport::PeerAddress address) +{ + auto params = RendezvousParameters().SetSetupPINCode(mSetupPINCode).SetDiscriminator(mDiscriminator).SetPeerAddress(address); + + CHIP_ERROR err = CHIP_NO_ERROR; + auto commissioningParams = GetCommissioningParameters(); + err = CurrentCommissioner().PairDevice(remoteId, params, commissioningParams); + + return err; +} + +void PairingManager::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_ERROR err) +{ + PairingManager * self = reinterpret_cast(context); + VerifyOrReturn(self != nullptr, ChipLogError(NotSpecified, "OnCurrentFabricRemove: context is null")); + + ChipLogProgress(NotSpecified, "PairingManager::OnCurrentFabricRemove"); + + if (err == CHIP_NO_ERROR) + { + // print to console + fprintf(stderr, "Device with Node ID: " ChipLogFormatX64 " has been successfully removed.\n", ChipLogValueX64(nodeId)); + + if (self->mPairingDelegate) + { + self->mPairingDelegate->OnDeviceRemoved(nodeId, err); + self->SetPairingDelegate(nullptr); + } + } + else + { + ChipLogProgress(NotSpecified, "Device unpair Failure: " ChipLogFormatX64 " %s", ChipLogValueX64(nodeId), ErrorStr(err)); + } +} + +void PairingManager::InitPairingCommand() +{ + mCommissioner->RegisterPairingDelegate(this); +} + +CHIP_ERROR PairingManager::PairDeviceWithCode(NodeId nodeId, const char * payload) +{ + if (payload == nullptr || strlen(payload) > kMaxManualCodeLength + 1) + { + ChipLogError(NotSpecified, "PairDeviceWithCode failed: Invalid pairing payload"); + return CHIP_ERROR_INVALID_STRING_LENGTH; + } + + Platform::CopyString(mOnboardingPayload, sizeof(mOnboardingPayload), payload); + + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId]() { + PairingManager & self = PairingManager::Instance(); + + self.InitPairingCommand(); + + CommissioningParameters commissioningParams = self.GetCommissioningParameters(); + auto discoveryType = DiscoveryType::kDiscoveryNetworkOnly; + + self.mNodeId = nodeId; + + CHIP_ERROR err = self.mCommissioner->PairDevice(nodeId, self.mOnboardingPayload, commissioningParams, discoveryType); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair device with code, error: %s", ErrorStr(err)); + } + }); +} + +CHIP_ERROR PairingManager::PairDevice(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, + uint16_t deviceRemotePort) +{ + if (deviceRemoteIp == nullptr || strlen(deviceRemoteIp) > Inet::IPAddress::kMaxStringLength) + { + ChipLogError(NotSpecified, "PairDevice failed: Invalid device remote IP address"); + return CHIP_ERROR_INVALID_STRING_LENGTH; + } + + Platform::CopyString(mRemoteIpAddr, sizeof(mRemoteIpAddr), deviceRemoteIp); + + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId, setupPINCode, deviceRemotePort]() { + PairingManager & self = PairingManager::Instance(); + + self.InitPairingCommand(); + self.mSetupPINCode = setupPINCode; + + Inet::IPAddress address; + Inet::InterfaceId interfaceId; + + if (!ParseAddressWithInterface(self.mRemoteIpAddr, address, interfaceId)) + { + ChipLogError(NotSpecified, "Invalid IP address: %s", self.mRemoteIpAddr); + return; + } + + CHIP_ERROR err = self.Pair(nodeId, Transport::PeerAddress::UDP(address, deviceRemotePort, interfaceId)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair device, error: %s", ErrorStr(err)); + } + }); +} + +CHIP_ERROR PairingManager::UnpairDevice(NodeId nodeId) +{ + return DeviceLayer::SystemLayer().ScheduleLambda([nodeId]() { + PairingManager & self = PairingManager::Instance(); + + self.InitPairingCommand(); + + self.mCurrentFabricRemover = Platform::MakeUnique(self.mCommissioner); + + if (!self.mCurrentFabricRemover) + { + ChipLogError(NotSpecified, "Failed to unpair device, mCurrentFabricRemover is null"); + return; + } + + CHIP_ERROR err = self.mCurrentFabricRemover->RemoveCurrentFabric(nodeId, &self.mCurrentFabricRemoveCallback); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to unpair device, error: %s", ErrorStr(err)); + } + }); +} + +} // namespace admin diff --git a/examples/fabric-sync/admin/PairingManager.h b/examples/fabric-sync/admin/PairingManager.h new file mode 100644 index 0000000000..b9b404ee76 --- /dev/null +++ b/examples/fabric-sync/admin/PairingManager.h @@ -0,0 +1,199 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include +#include + +namespace admin { + +// Constants +constexpr uint16_t kMaxManualCodeLength = 22; + +class CommissioningWindowDelegate +{ +public: + virtual void OnCommissioningWindowOpened(chip::NodeId deviceId, CHIP_ERROR err, chip::SetupPayload payload) = 0; + virtual ~CommissioningWindowDelegate() = default; +}; + +class PairingDelegate +{ +public: + virtual void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) {} + virtual void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) {} + virtual ~PairingDelegate() = default; +}; + +/** + * The PairingManager class is responsible for managing the commissioning and pairing process + * of Matter devices. PairingManager is designed to be used as a singleton, meaning that there + * should only be one instance of it running at any given time. + * + * Usage: + * + * 1. The class should be initialized when the system starts up, typically by invoking the static + * instance method to get the singleton. + * 2. To open a commissioning window, the appropriate method should be called on the PairingManager instance. + * 3. The PairingManager will handle the lifecycle of the CommissioningWindowOpener and ensure that + * resources are cleaned up appropriately when pairing is complete or the process is aborted. + * + * Example: + * + * @code + * PairingManager& manager = PairingManager::Instance(); + * manager.OpenCommissioningWindow(); + * @endcode + */ +class PairingManager : public chip::Controller::DevicePairingDelegate, + public chip::Controller::DeviceDiscoveryDelegate, + public chip::Credentials::DeviceAttestationDelegate +{ +public: + static PairingManager & Instance() + { + static PairingManager instance; + return instance; + } + + CHIP_ERROR Init(chip::Controller::DeviceCommissioner * commissioner); + + void SetOpenCommissioningWindowDelegate(CommissioningWindowDelegate * delegate) { mCommissioningWindowDelegate = delegate; } + void SetPairingDelegate(PairingDelegate * delegate) { mPairingDelegate = delegate; } + PairingDelegate * GetPairingDelegate() { return mPairingDelegate; } + + chip::Controller::DeviceCommissioner & CurrentCommissioner() { return *mCommissioner; }; + + /** + * Opens a commissioning window on the specified node and endpoint. + * Only one commissioning window can be active at a time. If a commissioning + * window is already open, this function will return an error. + * + * @param nodeId The target node ID for commissioning. + * @param endpointId The target endpoint ID for commissioning. + * @param commissioningTimeoutSec Timeout for the commissioning window in seconds. + * @param iterations Iterations for PBKDF calculations. + * @param discriminator Discriminator for commissioning. + * @param salt Optional salt for verifier-based commissioning. + * @param verifier Optional verifier for enhanced commissioning security. + * + * @return CHIP_ERROR_INCORRECT_STATE if a commissioning window is already open. + */ + CHIP_ERROR OpenCommissioningWindow(chip::NodeId nodeId, chip::EndpointId endpointId, uint16_t commissioningTimeoutSec, + uint32_t iterations, uint16_t discriminator, const chip::ByteSpan & salt, + const chip::ByteSpan & verifier); + + /** + * Pairs a device using a setup code payload. + * + * @param nodeId The target node ID for pairing. + * @param payload The setup code payload, which typically contains device-specific pairing information. + * + * @return CHIP_NO_ERROR on successful initiation of the pairing process, or an appropriate CHIP_ERROR if pairing fails. + */ + CHIP_ERROR PairDeviceWithCode(chip::NodeId nodeId, const char * payload); + + /** + * Pairs a device using its setup PIN code and remote IP address. + * + * @param nodeId The target node ID for pairing. + * @param setupPINCode The setup PIN code for the device, used for establishing a secure connection. + * @param deviceRemoteIp The IP address of the remote device. + * @param deviceRemotePort The port number on which the device is listening for pairing requests. + * + * @return CHIP_NO_ERROR if the pairing process is initiated successfully, or an appropriate CHIP_ERROR if pairing fails. + */ + CHIP_ERROR PairDevice(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, uint16_t deviceRemotePort); + + /** + * Unpairs a device with the specified node ID. + * + * @param nodeId The node ID of the device to be unpaired. + * + * @return CHIP_NO_ERROR if the device is successfully unpaired, or an appropriate CHIP_ERROR if the process fails. + */ + CHIP_ERROR UnpairDevice(chip::NodeId nodeId); + +private: + // Constructors + PairingManager(); + PairingManager(const PairingManager &) = delete; + PairingManager & operator=(const PairingManager &) = delete; + + // Private member functions (static and non-static) + chip::Controller::CommissioningParameters GetCommissioningParameters(); + void InitPairingCommand(); + CHIP_ERROR Pair(chip::NodeId remoteId, chip::Transport::PeerAddress address); + + /////////// DevicePairingDelegate Interface ///////// + void OnStatusUpdate(chip::Controller::DevicePairingDelegate::Status status) override; + void OnPairingComplete(CHIP_ERROR error) override; + void OnPairingDeleted(CHIP_ERROR error) override; + void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR error) override; + + /////////// DeviceDiscoveryDelegate Interface ///////// + void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; + + /////////// DeviceAttestationDelegate Interface ///////// + chip::Optional FailSafeExpiryTimeoutSecs() const override; + bool ShouldWaitAfterDeviceAttestation() override; + void OnDeviceAttestationCompleted(chip::Controller::DeviceCommissioner * deviceCommissioner, chip::DeviceProxy * device, + const chip::Credentials::DeviceAttestationVerifier::AttestationDeviceInfo & info, + chip::Credentials::AttestationVerificationResult attestationResult) override; + + static void OnOpenCommissioningWindowResponse(void * context, chip::NodeId deviceId, CHIP_ERROR status, + chip::SetupPayload payload); + static void OnOpenCommissioningWindowVerifierResponse(void * context, chip::NodeId deviceId, CHIP_ERROR status); + static void OnCurrentFabricRemove(void * context, chip::NodeId remoteNodeId, CHIP_ERROR status); + + // Private data members + chip::Controller::DeviceCommissioner * mCommissioner = nullptr; + + CommissioningWindowDelegate * mCommissioningWindowDelegate = nullptr; + PairingDelegate * mPairingDelegate = nullptr; + + chip::NodeId mNodeId = chip::kUndefinedNodeId; + chip::ByteSpan mVerifier; + chip::ByteSpan mSalt; + uint16_t mDiscriminator = 0; + uint32_t mSetupPINCode = 0; + uint8_t mVerifierBuffer[chip::Crypto::kSpake2p_VerifierSerialized_Length]; + uint8_t mSaltBuffer[chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length]; + char mRemoteIpAddr[chip::Inet::IPAddress::kMaxStringLength]; + char mOnboardingPayload[kMaxManualCodeLength + 1]; + + /** + * Holds the unique_ptr to the current CommissioningWindowOpener. + * Only one commissioning window opener can be active at a time. + * The pointer is reset when the commissioning window is closed or when an error occurs. + */ + chip::Platform::UniquePtr mWindowOpener; + chip::Callback::Callback mOnOpenCommissioningWindowCallback; + chip::Callback::Callback mOnOpenCommissioningWindowVerifierCallback; + + // For Unpair + chip::Platform::UniquePtr mCurrentFabricRemover; + chip::Callback::Callback mCurrentFabricRemoveCallback; +}; + +} // namespace admin diff --git a/examples/fabric-sync/bridge/include/BridgedAdministratorCommissioning.h b/examples/fabric-sync/bridge/include/BridgedAdministratorCommissioning.h index 06fd9026d4..7b5711d395 100644 --- a/examples/fabric-sync/bridge/include/BridgedAdministratorCommissioning.h +++ b/examples/fabric-sync/bridge/include/BridgedAdministratorCommissioning.h @@ -20,6 +20,8 @@ #include #include +namespace bridge { + /** * @brief CADMIN cluster implementation for handling attribute interactions of bridged device endpoints. * @@ -56,3 +58,5 @@ class BridgedAdministratorCommissioning : public chip::app::AttributeAccessInter // to reflect this change. chip::app::AttributeAccessInterface * mOriginalAttributeInterface = nullptr; }; + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/include/BridgedDevice.h b/examples/fabric-sync/bridge/include/BridgedDevice.h index d2c5a64b9e..ed5c971062 100644 --- a/examples/fabric-sync/bridge/include/BridgedDevice.h +++ b/examples/fabric-sync/bridge/include/BridgedDevice.h @@ -23,6 +23,8 @@ #include +namespace bridge { + class BridgedDevice { public: @@ -90,3 +92,5 @@ class BridgedDevice BridgedAttributes mAttributes; AdminCommissioningAttributes mAdminCommissioningAttributes; }; + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/include/BridgedDeviceBasicInformationImpl.h b/examples/fabric-sync/bridge/include/BridgedDeviceBasicInformationImpl.h index 23403438ab..f57f7d0362 100644 --- a/examples/fabric-sync/bridge/include/BridgedDeviceBasicInformationImpl.h +++ b/examples/fabric-sync/bridge/include/BridgedDeviceBasicInformationImpl.h @@ -18,6 +18,8 @@ #include #include +namespace bridge { + class BridgedDeviceBasicInformationImpl : public chip::app::AttributeAccessInterface { public: @@ -30,3 +32,5 @@ class BridgedDeviceBasicInformationImpl : public chip::app::AttributeAccessInter CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath & path, chip::app::AttributeValueEncoder & encoder) override; CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath & path, chip::app::AttributeValueDecoder & decoder) override; }; + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/include/BridgedDeviceManager.h b/examples/fabric-sync/bridge/include/BridgedDeviceManager.h index 127898fc5b..6d17276766 100644 --- a/examples/fabric-sync/bridge/include/BridgedDeviceManager.h +++ b/examples/fabric-sync/bridge/include/BridgedDeviceManager.h @@ -24,6 +24,8 @@ #include +namespace bridge { + class BridgedDeviceManager { public: @@ -52,9 +54,9 @@ class BridgedDeviceManager * * @param dev A pointer to the device to be added. * @param parentEndpointId The parent endpoint ID. Defaults to an invalid endpoint ID. - * @return int The index of the dynamic endpoint if successful, nullopt otherwise + * @return uint16_t The index of the dynamic endpoint if successful, nullopt otherwise */ - std::optional AddDeviceEndpoint(std::unique_ptr dev, + std::optional AddDeviceEndpoint(std::unique_ptr dev, chip::EndpointId parentEndpointId = chip::kInvalidEndpointId); /** @@ -100,9 +102,9 @@ class BridgedDeviceManager * found, it removes the dynamic endpoint. * * @param scopedNodeId The ScopedNodeId of the device to be removed. - * @return unsigned of the index of the removed dynamic endpoint if successful, nullopt otherwise. + * @return uint16_t of the index of the removed dynamic endpoint if successful, nullopt otherwise. */ - std::optional RemoveDeviceByScopedNodeId(chip::ScopedNodeId scopedNodeId); + std::optional RemoveDeviceByScopedNodeId(chip::ScopedNodeId scopedNodeId); /** * Finds the device with the given unique id (if any) @@ -134,3 +136,5 @@ inline BridgedDeviceManager & BridgeDeviceMgr() { return BridgedDeviceManager::sInstance; } + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/include/CHIPProjectAppConfig.h b/examples/fabric-sync/bridge/include/CHIPProjectAppConfig.h index b1a711658d..58f45c0305 100644 --- a/examples/fabric-sync/bridge/include/CHIPProjectAppConfig.h +++ b/examples/fabric-sync/bridge/include/CHIPProjectAppConfig.h @@ -36,6 +36,9 @@ // FabricSync needs to be both commissioners and commissionees #define CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE 1 +// See issue 23625. +#define CHIP_CONFIG_UNSAFE_SUBSCRIPTION_EXCHANGE_MANAGER_USE 1 + // Enable app platform #define CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED 1 diff --git a/examples/fabric-sync/bridge/src/BridgedAdministratorCommissioning.cpp b/examples/fabric-sync/bridge/src/BridgedAdministratorCommissioning.cpp index a0d87cbb3b..3299df75a9 100644 --- a/examples/fabric-sync/bridge/src/BridgedAdministratorCommissioning.cpp +++ b/examples/fabric-sync/bridge/src/BridgedAdministratorCommissioning.cpp @@ -26,6 +26,8 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::AdministratorCommissioning; +namespace bridge { + CHIP_ERROR BridgedAdministratorCommissioning::Init() { // We expect initialization after emberAfInit(). This allows us to unregister the existing @@ -79,3 +81,5 @@ CHIP_ERROR BridgedAdministratorCommissioning::Read(const ConcreteReadAttributePa return CHIP_NO_ERROR; } + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/src/BridgedDevice.cpp b/examples/fabric-sync/bridge/src/BridgedDevice.cpp index f462d1cce6..bd88c89145 100644 --- a/examples/fabric-sync/bridge/src/BridgedDevice.cpp +++ b/examples/fabric-sync/bridge/src/BridgedDevice.cpp @@ -27,6 +27,8 @@ using namespace chip; using namespace chip::app::Clusters::Actions; +namespace bridge { + BridgedDevice::BridgedDevice(ScopedNodeId scopedNodeId) { mReachable = false; @@ -116,3 +118,5 @@ void BridgedDevice::SetAdminCommissioningAttributes(const AdminCommissioningAttr } }); } + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/src/BridgedDeviceBasicInformationImpl.cpp b/examples/fabric-sync/bridge/src/BridgedDeviceBasicInformationImpl.cpp index 7fa48a4a15..d021671c8b 100644 --- a/examples/fabric-sync/bridge/src/BridgedDeviceBasicInformationImpl.cpp +++ b/examples/fabric-sync/bridge/src/BridgedDeviceBasicInformationImpl.cpp @@ -29,6 +29,8 @@ using namespace ::chip; using namespace ::chip::app; using namespace ::chip::app::Clusters; +namespace bridge { + CHIP_ERROR BridgedDeviceBasicInformationImpl::Read(const ConcreteReadAttributePath & path, AttributeValueEncoder & encoder) { // Registration is done for the bridged device basic information only @@ -105,3 +107,5 @@ CHIP_ERROR BridgedDeviceBasicInformationImpl::Write(const ConcreteDataAttributeP return CHIP_ERROR_INVALID_ARGUMENT; } + +} // namespace bridge diff --git a/examples/fabric-sync/bridge/src/BridgedDeviceManager.cpp b/examples/fabric-sync/bridge/src/BridgedDeviceManager.cpp index 0265f91202..09c1b643c0 100644 --- a/examples/fabric-sync/bridge/src/BridgedDeviceManager.cpp +++ b/examples/fabric-sync/bridge/src/BridgedDeviceManager.cpp @@ -45,6 +45,8 @@ using namespace chip::Transport; using namespace chip::DeviceLayer; using namespace chip::app::Clusters; +namespace bridge { + namespace { constexpr uint8_t kMaxRetries = 10; @@ -184,7 +186,7 @@ void BridgedDeviceManager::Init() mCurrentEndpointId = mFirstDynamicEndpointId; } -std::optional BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr dev, +std::optional BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr dev, chip::EndpointId parentEndpointId) { EmberAfEndpointType * ep = dev->IsIcd() ? &sIcdBridgedNodeEndpoint : &sBridgedNodeEndpoint; @@ -194,6 +196,8 @@ std::optional BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr< // TODO: this shares data version among different clusters, which seems incorrect const chip::Span & dataVersionStorage = Span(sBridgedNodeDataVersions); + assertChipStackLockedByCurrentThread(); + if (dev->GetBridgedAttributes().uniqueId.empty()) { dev->SetUniqueId(GenerateUniqueId()); @@ -204,7 +208,7 @@ std::optional BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr< return std::nullopt; } - for (unsigned index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; index++) + for (uint16_t index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; index++) { if (mDevices[index]) { @@ -213,7 +217,6 @@ std::optional BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr< for (int retryCount = 0; retryCount < kMaxRetries; retryCount++) { - DeviceLayer::StackLock lock; dev->SetEndpointId(mCurrentEndpointId); dev->SetParentEndpointId(parentEndpointId); CHIP_ERROR err = @@ -327,9 +330,9 @@ BridgedDevice * BridgedDeviceManager::GetDeviceByScopedNodeId(chip::ScopedNodeId return nullptr; } -std::optional BridgedDeviceManager::RemoveDeviceByScopedNodeId(chip::ScopedNodeId scopedNodeId) +std::optional BridgedDeviceManager::RemoveDeviceByScopedNodeId(chip::ScopedNodeId scopedNodeId) { - for (unsigned index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index) + for (uint16_t index = 0; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index) { if (mDevices[index] && mDevices[index]->GetScopedNodeId() == scopedNodeId) { @@ -343,3 +346,5 @@ std::optional BridgedDeviceManager::RemoveDeviceByScopedNodeId(chip::S } return std::nullopt; } + +} // namespace bridge diff --git a/examples/fabric-sync/main.cpp b/examples/fabric-sync/main.cpp index 84c014dfcb..3cd5ab8c20 100644 --- a/examples/fabric-sync/main.cpp +++ b/examples/fabric-sync/main.cpp @@ -17,17 +17,77 @@ */ #include +#include + +#if defined(ENABLE_CHIP_SHELL) +#include "ShellCommands.h" +#endif using namespace chip; +namespace { + +constexpr char kFabricSyncLogFilePath[] = "/tmp/fabric_sync.log"; + +// File pointer for the log file +FILE * sLogFile = nullptr; + +void OpenLogFile(const char * filePath) +{ + sLogFile = fopen(filePath, "a"); + if (sLogFile == nullptr) + { + perror("Failed to open log file"); + } +} + +void CloseLogFile() +{ + if (sLogFile != nullptr) + { + fclose(sLogFile); + sLogFile = nullptr; + } +} + +void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, const char * msg, va_list args) +{ + if (sLogFile == nullptr) + { + return; + } + + uint64_t timeMs = System::SystemClock().GetMonotonicMilliseconds64().count(); + uint64_t seconds = timeMs / 1000; + uint64_t milliseconds = timeMs % 1000; + + flockfile(sLogFile); + + fprintf(sLogFile, "[%llu.%06llu] CHIP:%s: ", static_cast(seconds), + static_cast(milliseconds), module); + vfprintf(sLogFile, msg, args); + fprintf(sLogFile, "\n"); + fflush(sLogFile); + + funlockfile(sLogFile); +} + +} // namespace + void ApplicationInit() { ChipLogProgress(NotSpecified, "Fabric-Sync: ApplicationInit()"); + + OpenLogFile(kFabricSyncLogFilePath); + + // Redirect logs to the custom logging callback + Logging::SetLogRedirectCallback(LoggingCallback); } void ApplicationShutdown() { ChipLogDetail(NotSpecified, "Fabric-Sync: ApplicationShutdown()"); + CloseLogFile(); } int main(int argc, char * argv[]) @@ -35,6 +95,19 @@ int main(int argc, char * argv[]) VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); +#if defined(ENABLE_CHIP_SHELL) + Shell::RegisterCommands(); +#endif + + CHIP_ERROR err = admin::PairingManager::Instance().Init(GetDeviceCommissioner()); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Failed to init PairingManager: %s ", ErrorStr(err)); + + // End the program with non zero error code to indicate a error. + return 1; + } + ChipLinuxAppMainLoop(); return 0; diff --git a/examples/fabric-sync/shell/AddBridgeCommand.cpp b/examples/fabric-sync/shell/AddBridgeCommand.cpp new file mode 100644 index 0000000000..936ac1c321 --- /dev/null +++ b/examples/fabric-sync/shell/AddBridgeCommand.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "AddBridgeCommand.h" + +#include +#include + +using namespace ::chip; + +namespace commands { + +AddBridgeCommand::AddBridgeCommand(chip::NodeId nodeId, uint32_t setupPINCode, const char * remoteAddr, uint16_t remotePort) : + mBridgeNodeId(nodeId), mSetupPINCode(setupPINCode), mRemoteAddr(remoteAddr), mRemotePort(remotePort) +{} + +void AddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) +{ + if (mBridgeNodeId != deviceId) + { + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair non-bridge device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Commissioning complete for non-bridge device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(deviceId)); + } + return; + } + + if (err == CHIP_NO_ERROR) + { + admin::DeviceMgr().SetRemoteBridgeNodeId(mBridgeNodeId); + + ChipLogProgress(NotSpecified, "Successfully paired bridge device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(mBridgeNodeId)); + + admin::DeviceMgr().UpdateLastUsedNodeId(mBridgeNodeId); + } + else + { + ChipLogError(NotSpecified, "Failed to pair bridge device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + CommandRegistry::Instance().ResetActiveCommand(); +} + +CHIP_ERROR AddBridgeCommand::RunCommand() +{ + if (admin::DeviceMgr().IsFabricSyncReady()) + { + // print to console + fprintf(stderr, "Remote Fabric Bridge has already been configured.\n"); + return CHIP_NO_ERROR; + } + + admin::PairingManager::Instance().SetPairingDelegate(this); + + return admin::DeviceMgr().PairRemoteFabricBridge(mBridgeNodeId, mSetupPINCode, mRemoteAddr, mRemotePort); +} + +} // namespace commands diff --git a/examples/fabric-sync/shell/AddBridgeCommand.h b/examples/fabric-sync/shell/AddBridgeCommand.h new file mode 100644 index 0000000000..d2f6ff7b30 --- /dev/null +++ b/examples/fabric-sync/shell/AddBridgeCommand.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include + +namespace commands { + +class AddBridgeCommand : public Command, public admin::PairingDelegate +{ +public: + AddBridgeCommand(chip::NodeId nodeId, uint32_t setupPINCode, const char * remoteAddr, uint16_t remotePort); + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override; + CHIP_ERROR RunCommand() override; + +private: + chip::NodeId mBridgeNodeId; + uint32_t mSetupPINCode; + const char * mRemoteAddr; + uint16_t mRemotePort; +}; + +} // namespace commands diff --git a/examples/fabric-sync/shell/AddDeviceCommand.cpp b/examples/fabric-sync/shell/AddDeviceCommand.cpp new file mode 100644 index 0000000000..218691e744 --- /dev/null +++ b/examples/fabric-sync/shell/AddDeviceCommand.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "AddDeviceCommand.h" + +#include +#include + +using namespace ::chip; + +namespace commands { + +AddDeviceCommand::AddDeviceCommand(chip::NodeId nodeId, uint32_t setupPINCode, const char * remoteAddr, uint16_t remotePort) : + mNodeId(nodeId), mSetupPINCode(setupPINCode), mRemoteAddr(remoteAddr), mRemotePort(remotePort) +{} + +void AddDeviceCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) +{ + if (mNodeId != deviceId) + { + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, + "Failed to pair non-specified device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Commissioning complete for non-specified device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(deviceId)); + } + return; + } + + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Successfully paired device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mNodeId)); + + admin::DeviceMgr().UpdateLastUsedNodeId(mNodeId); + } + else + { + ChipLogError(NotSpecified, "Failed to pair device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + CommandRegistry::Instance().ResetActiveCommand(); +} + +CHIP_ERROR AddDeviceCommand::RunCommand() +{ + if (admin::DeviceMgr().IsCurrentBridgeDevice(mNodeId)) + { + // print to console + fprintf(stderr, "The specified node ID has been reserved by the Fabric Bridge.\n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + admin::PairingManager::Instance().SetPairingDelegate(this); + + return admin::DeviceMgr().PairRemoteDevice(mNodeId, mSetupPINCode, mRemoteAddr, mRemotePort); +} + +} // namespace commands diff --git a/examples/fabric-sync/shell/AddDeviceCommand.h b/examples/fabric-sync/shell/AddDeviceCommand.h new file mode 100644 index 0000000000..35d0ed93d9 --- /dev/null +++ b/examples/fabric-sync/shell/AddDeviceCommand.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include + +namespace commands { + +class AddDeviceCommand : public Command, public admin::PairingDelegate +{ +public: + AddDeviceCommand(chip::NodeId nodeId, uint32_t setupPINCode, const char * remoteAddr, uint16_t remotePort); + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override; + CHIP_ERROR RunCommand() override; + +private: + chip::NodeId mNodeId; + uint32_t mSetupPINCode; + const char * mRemoteAddr; + uint16_t mRemotePort; +}; + +} // namespace commands diff --git a/examples/fabric-sync/shell/BUILD.gn b/examples/fabric-sync/shell/BUILD.gn new file mode 100644 index 0000000000..b3726ee178 --- /dev/null +++ b/examples/fabric-sync/shell/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("${chip_root}/src/app/chip_data_model.gni") + +config("config") { + include_dirs = [ + ".", + "${chip_root}/examples/common", + "${chip_root}/examples/fabric-sync", + ] +} + +source_set("shell") { + public_configs = [ ":config" ] + + sources = [ + "AddBridgeCommand.cpp", + "AddBridgeCommand.h", + "AddDeviceCommand.cpp", + "AddDeviceCommand.h", + "CommandRegistry.h", + "RemoveBridgeCommand.cpp", + "RemoveBridgeCommand.h", + "RemoveDeviceCommand.cpp", + "RemoveDeviceCommand.h", + "ShellCommands.cpp", + "ShellCommands.h", + ] + + deps = [ + "${chip_root}/examples/fabric-sync/admin:fabric-admin-lib", + "${chip_root}/examples/fabric-sync/bridge:fabric-bridge-lib", + "${chip_root}/src/lib", + ] +} diff --git a/examples/fabric-sync/shell/CommandRegistry.h b/examples/fabric-sync/shell/CommandRegistry.h new file mode 100644 index 0000000000..ec53e17960 --- /dev/null +++ b/examples/fabric-sync/shell/CommandRegistry.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include + +namespace commands { + +class Command +{ +public: + virtual ~Command() = default; + virtual CHIP_ERROR RunCommand() = 0; +}; + +class CommandRegistry +{ +public: + static CommandRegistry & Instance() + { + static CommandRegistry instance; + return instance; + } + + void SetActiveCommand(std::unique_ptr command) { mActiveCommand = std::move(command); } + + Command * GetActiveCommand() { return mActiveCommand.get(); } + + void ResetActiveCommand() { mActiveCommand.reset(); } + + bool IsCommandActive() const { return mActiveCommand != nullptr; } + +private: + CommandRegistry() = default; + std::unique_ptr mActiveCommand; +}; + +} // namespace commands diff --git a/examples/fabric-sync/shell/RemoveBridgeCommand.cpp b/examples/fabric-sync/shell/RemoveBridgeCommand.cpp new file mode 100644 index 0000000000..2eaaf6fc34 --- /dev/null +++ b/examples/fabric-sync/shell/RemoveBridgeCommand.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "RemoveBridgeCommand.h" + +#include +#include + +using namespace ::chip; + +namespace commands { + +void RemoveBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR err) +{ + if (mBridgeNodeId != deviceId) + { + ChipLogProgress(NotSpecified, "An non-bridge device: NodeId: " ChipLogFormatX64 " is removed.", ChipLogValueX64(deviceId)); + return; + } + + if (err == CHIP_NO_ERROR) + { + admin::DeviceMgr().SetRemoteBridgeNodeId(kUndefinedNodeId); + + // print to console + fprintf(stderr, "Successfully removed bridge device: NodeId: " ChipLogFormatX64 "\n", ChipLogValueX64(mBridgeNodeId)); + } + else + { + ChipLogError(NotSpecified, "Failed to remove bridge device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + CommandRegistry::Instance().ResetActiveCommand(); +} + +CHIP_ERROR RemoveBridgeCommand::RunCommand() +{ + NodeId bridgeNodeId = admin::DeviceMgr().GetRemoteBridgeNodeId(); + + if (bridgeNodeId == kUndefinedNodeId) + { + // print to console + fprintf(stderr, "Remote Fabric Bridge is not configured yet, nothing to remove.\n"); + return CHIP_NO_ERROR; + } + + mBridgeNodeId = bridgeNodeId; + + admin::PairingManager::Instance().SetPairingDelegate(this); + + return admin::DeviceMgr().UnpairRemoteFabricBridge(); +} + +} // namespace commands diff --git a/examples/fabric-sync/shell/RemoveBridgeCommand.h b/examples/fabric-sync/shell/RemoveBridgeCommand.h new file mode 100644 index 0000000000..b0e4b33d52 --- /dev/null +++ b/examples/fabric-sync/shell/RemoveBridgeCommand.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include + +namespace commands { + +class RemoveBridgeCommand : public Command, public admin::PairingDelegate +{ +public: + void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; + CHIP_ERROR RunCommand() override; + +private: + chip::NodeId mBridgeNodeId = chip::kUndefinedNodeId; +}; + +} // namespace commands diff --git a/examples/fabric-sync/shell/RemoveDeviceCommand.cpp b/examples/fabric-sync/shell/RemoveDeviceCommand.cpp new file mode 100644 index 0000000000..266a2ad106 --- /dev/null +++ b/examples/fabric-sync/shell/RemoveDeviceCommand.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "RemoveDeviceCommand.h" + +#include +#include + +using namespace ::chip; + +namespace commands { + +RemoveDeviceCommand::RemoveDeviceCommand(NodeId nodeId) : mNodeId(nodeId) {} + +void RemoveDeviceCommand::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR err) +{ + if (mNodeId != deviceId) + { + ChipLogProgress(NotSpecified, "An non-specified device: NodeId: " ChipLogFormatX64 " is removed.", + ChipLogValueX64(deviceId)); + return; + } + + if (err == CHIP_NO_ERROR) + { + // print to console + fprintf(stderr, "Successfully removed device: NodeId: " ChipLogFormatX64 "\n", ChipLogValueX64(mNodeId)); + } + else + { + ChipLogError(NotSpecified, "Failed to remove device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + CommandRegistry::Instance().ResetActiveCommand(); +} + +CHIP_ERROR RemoveDeviceCommand::RunCommand() +{ + if (admin::DeviceMgr().IsCurrentBridgeDevice(mNodeId)) + { + // print to console + fprintf(stderr, "The specified node ID has been reserved by the Fabric Bridge.\n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + admin::PairingManager::Instance().SetPairingDelegate(this); + + return admin::DeviceMgr().UnpairRemoteDevice(mNodeId); +} + +} // namespace commands diff --git a/examples/fabric-sync/shell/RemoveDeviceCommand.h b/examples/fabric-sync/shell/RemoveDeviceCommand.h new file mode 100644 index 0000000000..cb394d66b3 --- /dev/null +++ b/examples/fabric-sync/shell/RemoveDeviceCommand.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include + +namespace commands { + +class RemoveDeviceCommand : public Command, public admin::PairingDelegate +{ +public: + RemoveDeviceCommand(chip::NodeId nodeId); + void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; + CHIP_ERROR RunCommand() override; + +private: + chip::NodeId mNodeId = chip::kUndefinedNodeId; +}; + +} // namespace commands diff --git a/examples/fabric-sync/shell/ShellCommands.cpp b/examples/fabric-sync/shell/ShellCommands.cpp new file mode 100644 index 0000000000..fa859a34d5 --- /dev/null +++ b/examples/fabric-sync/shell/ShellCommands.cpp @@ -0,0 +1,222 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ShellCommands.h" +#include "AddBridgeCommand.h" +#include "AddDeviceCommand.h" +#include "RemoveBridgeCommand.h" +#include "RemoveDeviceCommand.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace Shell { + +static CHIP_ERROR PrintAllCommands() +{ + streamer_t * sout = streamer_get(); + streamer_printf(sout, " help Usage: app \r\n"); + streamer_printf(sout, + " add-bridge Pair remote fabric bridge to local fabric. Usage: app add-bridge node-id setup-pin-code " + "device-remote-ip device-remote-port\r\n"); + streamer_printf(sout, " remove-bridge Remove the remote fabric bridge from the local fabric. Usage: app remove-bridge\r\n"); + streamer_printf(sout, + " add-device Pair a device to local fabric. Usage: app add-device node-id setup-pin-code " + "device-remote-ip device-remote-port\r\n"); + streamer_printf(sout, " remove-device Remove a device from the local fabric. Usage: app remove-device node-id\r\n"); + streamer_printf(sout, " sync-device Sync a device from other ecosystem. Usage: app sync-device endpointid\r\n"); + streamer_printf(sout, "\r\n"); + + return CHIP_NO_ERROR; +} + +static CHIP_ERROR HandleAddBridgeCommand(int argc, char ** argv) +{ + if (argc != 5) + { + fprintf(stderr, + "Invalid arguments. Usage: app add-bridge \n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Check if there is already an active command + if (commands::CommandRegistry::Instance().IsCommandActive()) + { + fprintf(stderr, "Another command is currently active. Please wait until it completes.\n"); + return CHIP_ERROR_BUSY; + } + + // Parse arguments + chip::NodeId nodeId = static_cast(strtoull(argv[1], nullptr, 10)); + uint32_t setupPINCode = static_cast(strtoul(argv[2], nullptr, 10)); + const char * remoteAddr = argv[3]; + uint16_t remotePort = static_cast(strtoul(argv[4], nullptr, 10)); + + auto command = std::make_unique(nodeId, setupPINCode, remoteAddr, remotePort); + + CHIP_ERROR result = command->RunCommand(); + if (result == CHIP_NO_ERROR) + { + commands::CommandRegistry::Instance().SetActiveCommand(std::move(command)); + } + + return result; +} + +static CHIP_ERROR HandleRemoveBridgeCommand(int argc, char ** argv) +{ + if (argc != 1) + { + fprintf(stderr, "Invalid arguments. Usage: app remove-bridge\n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Check if there is already an active command + if (commands::CommandRegistry::Instance().IsCommandActive()) + { + fprintf(stderr, "Another command is currently active. Please wait until it completes.\n"); + return CHIP_ERROR_BUSY; + } + + auto command = std::make_unique(); + + CHIP_ERROR result = command->RunCommand(); + if (result == CHIP_NO_ERROR) + { + commands::CommandRegistry::Instance().SetActiveCommand(std::move(command)); + } + + return result; +} + +static CHIP_ERROR HandleAddDeviceCommand(int argc, char ** argv) +{ + if (argc != 5) + { + fprintf(stderr, + "Invalid arguments. Usage: app add-device \n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Check if there is already an active command + if (commands::CommandRegistry::Instance().IsCommandActive()) + { + fprintf(stderr, "Another command is currently active. Please wait until it completes.\n"); + return CHIP_ERROR_BUSY; + } + + // Parse arguments + chip::NodeId nodeId = static_cast(strtoull(argv[1], nullptr, 10)); + uint32_t setupPINCode = static_cast(strtoul(argv[2], nullptr, 10)); + const char * remoteAddr = argv[3]; + uint16_t remotePort = static_cast(strtoul(argv[4], nullptr, 10)); + + auto command = std::make_unique(nodeId, setupPINCode, remoteAddr, remotePort); + + CHIP_ERROR result = command->RunCommand(); + if (result == CHIP_NO_ERROR) + { + commands::CommandRegistry::Instance().SetActiveCommand(std::move(command)); + } + + return result; +} + +static CHIP_ERROR HandleRemoveDeviceCommand(int argc, char ** argv) +{ + if (argc != 2) + { + fprintf(stderr, "Invalid arguments. Usage: app remove-device \n"); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Check if there is already an active command + if (commands::CommandRegistry::Instance().IsCommandActive()) + { + fprintf(stderr, "Another command is currently active. Please wait until it completes.\n"); + return CHIP_ERROR_BUSY; + } + + // Parse arguments + chip::NodeId nodeId = static_cast(strtoull(argv[1], nullptr, 10)); + + auto command = std::make_unique(nodeId); + + CHIP_ERROR result = command->RunCommand(); + if (result == CHIP_NO_ERROR) + { + commands::CommandRegistry::Instance().SetActiveCommand(std::move(command)); + } + + return result; +} + +static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + + if (argc == 0 || strcmp(argv[0], "help") == 0) + { + return PrintAllCommands(); + } + else if (argc == 0 || strcmp(argv[0], "?") == 0) + { + return PrintAllCommands(); + } + else if (strcmp(argv[0], "add-bridge") == 0) + { + return HandleAddBridgeCommand(argc, argv); + } + else if (strcmp(argv[0], "remove-bridge") == 0) + { + return HandleRemoveBridgeCommand(argc, argv); + } + else if (strcmp(argv[0], "add-device") == 0) + { + return HandleAddDeviceCommand(argc, argv); + } + else if (strcmp(argv[0], "remove-device") == 0) + { + return HandleRemoveDeviceCommand(argc, argv); + } + else + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + return error; +} + +void RegisterCommands() +{ + + static const shell_command_t sDeviceComand = { &AppPlatformHandler, "app", "App commands. Usage: app [command_name]" }; + + // Register the root `device` command with the top-level shell. + Engine::Root().RegisterCommands(&sDeviceComand, 1); +} + +} // namespace Shell +} // namespace chip diff --git a/examples/lit-icd-app/silabs/include/ShellCommands.h b/examples/fabric-sync/shell/ShellCommands.h similarity index 75% rename from examples/lit-icd-app/silabs/include/ShellCommands.h rename to examples/fabric-sync/shell/ShellCommands.h index 8817c41bfb..ab957bc8cd 100644 --- a/examples/lit-icd-app/silabs/include/ShellCommands.h +++ b/examples/fabric-sync/shell/ShellCommands.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,14 +16,12 @@ * limitations under the License. */ -#pragma once +#include -#ifdef ENABLE_CHIP_SHELL +namespace chip { +namespace Shell { -namespace LitICDCommands { +void RegisterCommands(); -void RegisterLitICDCommands(); - -} // namespace LitICDCommands - -#endif // ENABLE_CHIP_SHELL +} // namespace Shell +} // namespace chip diff --git a/examples/java-matter-controller/include/CHIPProjectAppConfig.h b/examples/java-matter-controller/include/CHIPProjectAppConfig.h index 09183cc448..951b79db36 100644 --- a/examples/java-matter-controller/include/CHIPProjectAppConfig.h +++ b/examples/java-matter-controller/include/CHIPProjectAppConfig.h @@ -46,8 +46,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 1 // Enable some test-only interaction model APIs. diff --git a/examples/kotlin-matter-controller/include/CHIPProjectAppConfig.h b/examples/kotlin-matter-controller/include/CHIPProjectAppConfig.h index 09183cc448..951b79db36 100644 --- a/examples/kotlin-matter-controller/include/CHIPProjectAppConfig.h +++ b/examples/kotlin-matter-controller/include/CHIPProjectAppConfig.h @@ -46,8 +46,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 1 // Enable some test-only interaction model APIs. diff --git a/examples/laundry-washer-app/nxp/rt/rt1060/BUILD.gn b/examples/laundry-washer-app/nxp/rt/rt1060/BUILD.gn index eb7ea93bbd..ee1e896987 100644 --- a/examples/laundry-washer-app/nxp/rt/rt1060/BUILD.gn +++ b/examples/laundry-washer-app/nxp/rt/rt1060/BUILD.gn @@ -170,7 +170,7 @@ rt_executable("laundry-washer") { "../../common/main/operational-state-delegate-impl.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/laundry-washer-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h b/examples/laundry-washer-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h index dd73c6c9ea..61be086710 100644 --- a/examples/laundry-washer-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h +++ b/examples/laundry-washer-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h @@ -167,15 +167,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/laundry-washer-app/nxp/rt/rt1170/BUILD.gn b/examples/laundry-washer-app/nxp/rt/rt1170/BUILD.gn index 96b035e862..90be59719a 100644 --- a/examples/laundry-washer-app/nxp/rt/rt1170/BUILD.gn +++ b/examples/laundry-washer-app/nxp/rt/rt1170/BUILD.gn @@ -158,7 +158,7 @@ rt_executable("laundry-washer-app") { "../../common/main/operational-state-delegate-impl.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/laundry-washer-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h b/examples/laundry-washer-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h index dd73c6c9ea..61be086710 100644 --- a/examples/laundry-washer-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h +++ b/examples/laundry-washer-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h @@ -167,15 +167,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn b/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn index 7f22eca6b2..936f1de4a7 100644 --- a/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn +++ b/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn @@ -57,8 +57,8 @@ rt_sdk("sdk") { defines = [] # To be moved, temporary mbedtls config fix to build app with factory data - if (chip_enable_secure_dac_private_key_storage || - chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_dac_private_key_storage || + nxp_enable_secure_whole_factory_data) { defines += [ "MBEDTLS_NIST_KW_C", "MBEDTLS_PSA_CRYPTO_CLIENT", @@ -142,10 +142,10 @@ rt_executable("laundry-washer") { "../../common/main/main.cpp", ] - if (chip_enable_secure_dac_private_key_storage || - chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_dac_private_key_storage || + nxp_enable_secure_whole_factory_data) { sources += [ "${chip_root}/examples/platform/nxp/${nxp_platform}/factory_data/source/AppFactoryDataExample.cpp" ] - if (chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_whole_factory_data) { defines += [ "ENABLE_SECURE_WHOLE_FACTORY_DATA" ] } } else { @@ -189,7 +189,7 @@ rt_executable("laundry-washer") { "../../common/main/operational-state-delegate-impl.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", diff --git a/examples/laundry-washer-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h b/examples/laundry-washer-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h index 2653e97705..33a42909f4 100644 --- a/examples/laundry-washer-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h +++ b/examples/laundry-washer-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h @@ -168,15 +168,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index a0d02751a8..ea9304fe7c 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:90 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:90 - Setup build environment: diff --git a/examples/light-switch-app/genio/args.gni b/examples/light-switch-app/genio/args.gni index ddbfb9fa47..b684adc4a6 100644 --- a/examples/light-switch-app/genio/args.gni +++ b/examples/light-switch-app/genio/args.gni @@ -18,8 +18,8 @@ import("${chip_root}/src/platform/mt793x/args.gni") mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" chip_enable_ble = true diff --git a/examples/light-switch-app/genio/build_for_wifi_args.gni b/examples/light-switch-app/genio/build_for_wifi_args.gni index cb0ea7600a..3001e6648f 100644 --- a/examples/light-switch-app/genio/build_for_wifi_args.gni +++ b/examples/light-switch-app/genio/build_for_wifi_args.gni @@ -18,5 +18,5 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false import("${chip_root}/src/platform/MT793X/wifi_args.gni") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/light-switch-app/light-switch-common/BUILD.gn b/examples/light-switch-app/light-switch-common/BUILD.gn index 8ec49aac0f..e9ec438656 100644 --- a/examples/light-switch-app/light-switch-common/BUILD.gn +++ b/examples/light-switch-app/light-switch-common/BUILD.gn @@ -14,8 +14,13 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/app/chip_data_model.gni") +import("${chip_root}/src/app/icd/icd.gni") chip_data_model("light-switch-common") { - zap_file = "light-switch-app.zap" + if (chip_enable_icd_lit) { + zap_file = "icd-lit-light-switch-app.zap" + } else { + zap_file = "light-switch-app.zap" + } is_server = true } diff --git a/examples/light-switch-app/light-switch-common/icd-lit-light-switch-app.matter b/examples/light-switch-app/light-switch-common/icd-lit-light-switch-app.matter new file mode 100644 index 0000000000..67ed0ab571 --- /dev/null +++ b/examples/light-switch-app/light-switch-common/icd-lit-light-switch-app.matter @@ -0,0 +1,3244 @@ +// This IDL was generated automatically by ZAP. +// It is for view/code review purposes only. + +enum AreaTypeTag : enum8 { + kAisle = 0; + kAttic = 1; + kBackDoor = 2; + kBackYard = 3; + kBalcony = 4; + kBallroom = 5; + kBathroom = 6; + kBedroom = 7; + kBorder = 8; + kBoxroom = 9; + kBreakfastRoom = 10; + kCarport = 11; + kCellar = 12; + kCloakroom = 13; + kCloset = 14; + kConservatory = 15; + kCorridor = 16; + kCraftRoom = 17; + kCupboard = 18; + kDeck = 19; + kDen = 20; + kDining = 21; + kDrawingRoom = 22; + kDressingRoom = 23; + kDriveway = 24; + kElevator = 25; + kEnsuite = 26; + kEntrance = 27; + kEntryway = 28; + kFamilyRoom = 29; + kFoyer = 30; + kFrontDoor = 31; + kFrontYard = 32; + kGameRoom = 33; + kGarage = 34; + kGarageDoor = 35; + kGarden = 36; + kGardenDoor = 37; + kGuestBathroom = 38; + kGuestBedroom = 39; + kGuestRestroom = 40; + kGuestRoom = 41; + kGym = 42; + kHallway = 43; + kHearthRoom = 44; + kKidsRoom = 45; + kKidsBedroom = 46; + kKitchen = 47; + kLarder = 48; + kLaundryRoom = 49; + kLawn = 50; + kLibrary = 51; + kLivingRoom = 52; + kLounge = 53; + kMediaTVRoom = 54; + kMudRoom = 55; + kMusicRoom = 56; + kNursery = 57; + kOffice = 58; + kOutdoorKitchen = 59; + kOutside = 60; + kPantry = 61; + kParkingLot = 62; + kParlor = 63; + kPatio = 64; + kPlayRoom = 65; + kPoolRoom = 66; + kPorch = 67; + kPrimaryBathroom = 68; + kPrimaryBedroom = 69; + kRamp = 70; + kReceptionRoom = 71; + kRecreationRoom = 72; + kRestroom = 73; + kRoof = 74; + kSauna = 75; + kScullery = 76; + kSewingRoom = 77; + kShed = 78; + kSideDoor = 79; + kSideYard = 80; + kSittingRoom = 81; + kSnug = 82; + kSpa = 83; + kStaircase = 84; + kSteamRoom = 85; + kStorageRoom = 86; + kStudio = 87; + kStudy = 88; + kSunRoom = 89; + kSwimmingPool = 90; + kTerrace = 91; + kUtilityRoom = 92; + kWard = 93; + kWorkshop = 94; +} + +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + +enum FloorSurfaceTag : enum8 { + kCarpet = 0; + kCeramic = 1; + kConcrete = 2; + kCork = 3; + kDeepCarpet = 4; + kDirt = 5; + kEngineeredWood = 6; + kGlass = 7; + kGrass = 8; + kHardwood = 9; + kLaminate = 10; + kLinoleum = 11; + kMat = 12; + kMetal = 13; + kPlastic = 14; + kPolishedConcrete = 15; + kRubber = 16; + kRug = 17; + kSand = 18; + kStone = 19; + kTatami = 20; + kTerrazzo = 21; + kTile = 22; + kVinyl = 23; +} + +enum LandmarkTag : enum8 { + kAirConditioner = 0; + kAirPurifier = 1; + kBackDoor = 2; + kBarStool = 3; + kBathMat = 4; + kBathtub = 5; + kBed = 6; + kBookshelf = 7; + kChair = 8; + kChristmasTree = 9; + kCoatRack = 10; + kCoffeeTable = 11; + kCookingRange = 12; + kCouch = 13; + kCountertop = 14; + kCradle = 15; + kCrib = 16; + kDesk = 17; + kDiningTable = 18; + kDishwasher = 19; + kDoor = 20; + kDresser = 21; + kLaundryDryer = 22; + kFan = 23; + kFireplace = 24; + kFreezer = 25; + kFrontDoor = 26; + kHighChair = 27; + kKitchenIsland = 28; + kLamp = 29; + kLitterBox = 30; + kMirror = 31; + kNightstand = 32; + kOven = 33; + kPetBed = 34; + kPetBowl = 35; + kPetCrate = 36; + kRefrigerator = 37; + kScratchingPost = 38; + kShoeRack = 39; + kShower = 40; + kSideDoor = 41; + kSink = 42; + kSofa = 43; + kStove = 44; + kTable = 45; + kToilet = 46; + kTrashCan = 47; + kLaundryWasher = 48; + kWindow = 49; + kWineCooler = 50; +} + +enum PositionTag : enum8 { + kLeft = 0; + kRight = 1; + kTop = 2; + kBottom = 3; + kMiddle = 4; + kRow = 5; + kColumn = 6; +} + +enum RelativePositionTag : enum8 { + kUnder = 0; + kNextTo = 1; + kAround = 2; + kOn = 3; + kAbove = 4; + kFrontOf = 5; + kBehind = 6; +} + +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +enum ThreeLevelAutoEnum : enum8 { + kLow = 0; + kMedium = 1; + kHigh = 2; + kAutomatic = 3; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + +struct LocationDescriptorStruct { + char_string<128> locationName = 0; + nullable int16s floorNumber = 1; + nullable AreaTypeTag areaType = 2; +} + +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + +/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ +cluster Identify = 3 { + revision 4; + + enum EffectIdentifierEnum : enum8 { + kBlink = 0; + kBreathe = 1; + kOkay = 2; + kChannelChange = 11; + kFinishEffect = 254; + kStopEffect = 255; + } + + enum EffectVariantEnum : enum8 { + kDefault = 0; + } + + enum IdentifyTypeEnum : enum8 { + kNone = 0; + kLightOutput = 1; + kVisibleIndicator = 2; + kAudibleBeep = 3; + kDisplay = 4; + kActuator = 5; + } + + attribute int16u identifyTime = 0; + readonly attribute IdentifyTypeEnum identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct IdentifyRequest { + int16u identifyTime = 0; + } + + request struct TriggerEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + EffectVariantEnum effectVariant = 1; + } + + /** Command description for Identify */ + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + /** Command description for TriggerEffect */ + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; +} + +/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ +cluster Identify = 3 { + revision 4; + + enum EffectIdentifierEnum : enum8 { + kBlink = 0; + kBreathe = 1; + kOkay = 2; + kChannelChange = 11; + kFinishEffect = 254; + kStopEffect = 255; + } + + enum EffectVariantEnum : enum8 { + kDefault = 0; + } + + enum IdentifyTypeEnum : enum8 { + kNone = 0; + kLightOutput = 1; + kVisibleIndicator = 2; + kAudibleBeep = 3; + kDisplay = 4; + kActuator = 5; + } + + attribute int16u identifyTime = 0; + readonly attribute IdentifyTypeEnum identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct IdentifyRequest { + int16u identifyTime = 0; + } + + request struct TriggerEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + EffectVariantEnum effectVariant = 1; + } + + /** Command description for Identify */ + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + /** Command description for TriggerEffect */ + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; +} + +/** Attributes and commands for group configuration and manipulation. */ +cluster Groups = 4 { + revision 4; + + bitmap Feature : bitmap32 { + kGroupNames = 0x1; + } + + bitmap NameSupportBitmap : bitmap8 { + kGroupNames = 0x80; + } + + readonly attribute NameSupportBitmap nameSupport = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AddGroupRequest { + group_id groupID = 0; + char_string<16> groupName = 1; + } + + response struct AddGroupResponse = 0 { + enum8 status = 0; + group_id groupID = 1; + } + + request struct ViewGroupRequest { + group_id groupID = 0; + } + + response struct ViewGroupResponse = 1 { + enum8 status = 0; + group_id groupID = 1; + char_string<16> groupName = 2; + } + + request struct GetGroupMembershipRequest { + group_id groupList[] = 0; + } + + response struct GetGroupMembershipResponse = 2 { + nullable int8u capacity = 0; + group_id groupList[] = 1; + } + + request struct RemoveGroupRequest { + group_id groupID = 0; + } + + response struct RemoveGroupResponse = 3 { + enum8 status = 0; + group_id groupID = 1; + } + + request struct AddGroupIfIdentifyingRequest { + group_id groupID = 0; + char_string<16> groupName = 1; + } + + /** Command description for AddGroup */ + fabric command access(invoke: manage) AddGroup(AddGroupRequest): AddGroupResponse = 0; + /** Command description for ViewGroup */ + fabric command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; + /** Command description for GetGroupMembership */ + fabric command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; + /** Command description for RemoveGroup */ + fabric command access(invoke: manage) RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; + /** Command description for RemoveAllGroups */ + fabric command access(invoke: manage) RemoveAllGroups(): DefaultSuccess = 4; + /** Command description for AddGroupIfIdentifying */ + fabric command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; +} + +/** Attributes and commands for switching devices between 'On' and 'Off' states. */ +cluster OnOff = 6 { + revision 6; + + enum DelayedAllOffEffectVariantEnum : enum8 { + kDelayedOffFastFade = 0; + kNoFade = 1; + kDelayedOffSlowFade = 2; + } + + enum DyingLightEffectVariantEnum : enum8 { + kDyingLightFadeOff = 0; + } + + enum EffectIdentifierEnum : enum8 { + kDelayedAllOff = 0; + kDyingLight = 1; + } + + enum StartUpOnOffEnum : enum8 { + kOff = 0; + kOn = 1; + kToggle = 2; + } + + bitmap Feature : bitmap32 { + kLighting = 0x1; + kDeadFrontBehavior = 0x2; + kOffOnly = 0x4; + } + + bitmap OnOffControlBitmap : bitmap8 { + kAcceptOnlyWhenOn = 0x1; + } + + readonly attribute boolean onOff = 0; + readonly attribute optional boolean globalSceneControl = 16384; + attribute optional int16u onTime = 16385; + attribute optional int16u offWaitTime = 16386; + attribute access(write: manage) optional nullable StartUpOnOffEnum startUpOnOff = 16387; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OffWithEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + enum8 effectVariant = 1; + } + + request struct OnWithTimedOffRequest { + OnOffControlBitmap onOffControl = 0; + int16u onTime = 1; + int16u offWaitTime = 2; + } + + /** On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0. */ + command Off(): DefaultSuccess = 0; + /** On receipt of this command, a device SHALL enter its ‘On’ state. This state is device dependent, but it is recommended that it is used for power on or similar functions. On receipt of the On command, if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. */ + command On(): DefaultSuccess = 1; + /** On receipt of this command, if a device is in its ‘Off’ state it SHALL enter its ‘On’ state. Otherwise, if it is in its ‘On’ state it SHALL enter its ‘Off’ state. On receipt of the Toggle command, if the value of the OnOff attribute is equal to FALSE and if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. If the value of the OnOff attribute is equal to TRUE, the OnTime attribute SHALL be set to 0. */ + command Toggle(): DefaultSuccess = 2; + /** The OffWithEffect command allows devices to be turned off using enhanced ways of fading. */ + command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64; + /** The OnWithRecallGlobalScene command allows the recall of the settings when the device was turned off. */ + command OnWithRecallGlobalScene(): DefaultSuccess = 65; + /** The OnWithTimedOff command allows devices to be turned on for a specific duration with a guarded off duration so that SHOULD the device be subsequently switched off, further OnWithTimedOff commands, received during this time, are prevented from turning the devices back on. */ + command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66; +} + +/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ +cluster Descriptor = 29 { + revision 2; + + bitmap Feature : bitmap32 { + kTagList = 0x1; + } + + struct DeviceTypeStruct { + devtype_id deviceType = 0; + int16u revision = 1; + } + + struct SemanticTagStruct { + nullable vendor_id mfgCode = 0; + enum8 namespaceID = 1; + enum8 tag = 2; + optional nullable char_string label = 3; + } + + readonly attribute DeviceTypeStruct deviceTypeList[] = 0; + readonly attribute cluster_id serverList[] = 1; + readonly attribute cluster_id clientList[] = 2; + readonly attribute endpoint_no partsList[] = 3; + readonly attribute optional SemanticTagStruct tagList[] = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** The Binding Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for supporting the binding table. */ +cluster Binding = 30 { + revision 1; // NOTE: Default/not specifically set + + fabric_scoped struct TargetStruct { + optional node_id node = 1; + optional group_id group = 2; + optional endpoint_no endpoint = 3; + optional cluster_id cluster = 4; + fabric_idx fabricIndex = 254; + } + + attribute access(write: manage) TargetStruct binding[] = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** The Access Control Cluster exposes a data model view of a + Node's Access Control List (ACL), which codifies the rules used to manage + and enforce Access Control for the Node's endpoints and their associated + cluster instances. */ +cluster AccessControl = 31 { + revision 2; + + enum AccessControlEntryAuthModeEnum : enum8 { + kPASE = 1; + kCASE = 2; + kGroup = 3; + } + + enum AccessControlEntryPrivilegeEnum : enum8 { + kView = 1; + kProxyView = 2; + kOperate = 3; + kManage = 4; + kAdminister = 5; + } + + enum AccessRestrictionTypeEnum : enum8 { + kAttributeAccessForbidden = 0; + kAttributeWriteForbidden = 1; + kCommandForbidden = 2; + kEventForbidden = 3; + } + + enum ChangeTypeEnum : enum8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + + bitmap Feature : bitmap32 { + kExtension = 0x1; + kManagedDevice = 0x2; + } + + struct AccessRestrictionStruct { + AccessRestrictionTypeEnum type = 0; + nullable int32u id = 1; + } + + struct CommissioningAccessRestrictionEntryStruct { + endpoint_no endpoint = 0; + cluster_id cluster = 1; + AccessRestrictionStruct restrictions[] = 2; + } + + fabric_scoped struct AccessRestrictionEntryStruct { + fabric_sensitive endpoint_no endpoint = 0; + fabric_sensitive cluster_id cluster = 1; + fabric_sensitive AccessRestrictionStruct restrictions[] = 2; + fabric_idx fabricIndex = 254; + } + + struct AccessControlTargetStruct { + nullable cluster_id cluster = 0; + nullable endpoint_no endpoint = 1; + nullable devtype_id deviceType = 2; + } + + fabric_scoped struct AccessControlEntryStruct { + fabric_sensitive AccessControlEntryPrivilegeEnum privilege = 1; + fabric_sensitive AccessControlEntryAuthModeEnum authMode = 2; + nullable fabric_sensitive int64u subjects[] = 3; + nullable fabric_sensitive AccessControlTargetStruct targets[] = 4; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct AccessControlExtensionStruct { + fabric_sensitive octet_string<128> data = 1; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlEntryChanged = 0 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlEntryStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlExtensionChanged = 1 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlExtensionStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 2 { + int64u token = 0; + optional long_char_string instruction = 1; + optional long_char_string ARLRequestFlowUrl = 2; + fabric_idx fabricIndex = 254; + } + + attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0; + attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute optional CommissioningAccessRestrictionEntryStruct commissioningARL[] = 5; + readonly attribute optional AccessRestrictionEntryStruct arl[] = 6; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ReviewFabricRestrictionsRequest { + CommissioningAccessRestrictionEntryStruct arl[] = 0; + } + + response struct ReviewFabricRestrictionsResponse = 1 { + int64u token = 0; + } + + /** This command signals to the service associated with the device vendor that the fabric administrator would like a review of the current restrictions on the accessing fabric. */ + fabric command access(invoke: administer) ReviewFabricRestrictions(ReviewFabricRestrictionsRequest): ReviewFabricRestrictionsResponse = 0; +} + +/** This cluster provides attributes and events for determining basic information about Nodes, which supports both + Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number, + which apply to the whole Node. Also allows setting user device information such as location. */ +cluster BasicInformation = 40 { + revision 3; + + enum ColorEnum : enum8 { + kBlack = 0; + kNavy = 1; + kGreen = 2; + kTeal = 3; + kMaroon = 4; + kPurple = 5; + kOlive = 6; + kGray = 7; + kBlue = 8; + kLime = 9; + kAqua = 10; + kRed = 11; + kFuchsia = 12; + kYellow = 13; + kWhite = 14; + kNickel = 15; + kChrome = 16; + kBrass = 17; + kCopper = 18; + kSilver = 19; + kGold = 20; + } + + enum ProductFinishEnum : enum8 { + kOther = 0; + kMatte = 1; + kSatin = 2; + kPolished = 3; + kRugged = 4; + kFabric = 5; + } + + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + + struct ProductAppearanceStruct { + ProductFinishEnum finish = 0; + nullable ColorEnum primaryColor = 1; + } + + critical event StartUp = 0 { + int32u softwareVersion = 0; + } + + critical event ShutDown = 1 { + } + + info event Leave = 2 { + fabric_idx fabricIndex = 0; + } + + info event ReachableChanged = 3 { + boolean reachableNewValue = 0; + } + + readonly attribute int16u dataModelRevision = 0; + readonly attribute char_string<32> vendorName = 1; + readonly attribute vendor_id vendorID = 2; + readonly attribute char_string<32> productName = 3; + readonly attribute int16u productID = 4; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; + readonly attribute int16u hardwareVersion = 7; + readonly attribute char_string<64> hardwareVersionString = 8; + readonly attribute int32u softwareVersion = 9; + readonly attribute char_string<64> softwareVersionString = 10; + readonly attribute optional char_string<16> manufacturingDate = 11; + readonly attribute optional char_string<32> partNumber = 12; + readonly attribute optional long_char_string<256> productURL = 13; + readonly attribute optional char_string<64> productLabel = 14; + readonly attribute optional char_string<32> serialNumber = 15; + attribute access(write: manage) optional boolean localConfigDisabled = 16; + readonly attribute optional boolean reachable = 17; + readonly attribute char_string<32> uniqueID = 18; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute optional ProductAppearanceStruct productAppearance = 20; + readonly attribute int32u specificationVersion = 21; + readonly attribute int16u maxPathsPerInvoke = 22; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + command MfgSpecificPing(): DefaultSuccess = 0; +} + +/** Provides an interface for providing OTA software updates */ +cluster OtaSoftwareUpdateProvider = 41 { + revision 1; // NOTE: Default/not specifically set + + enum ApplyUpdateActionEnum : enum8 { + kProceed = 0; + kAwaitNextAction = 1; + kDiscontinue = 2; + } + + enum DownloadProtocolEnum : enum8 { + kBDXSynchronous = 0; + kBDXAsynchronous = 1; + kHTTPS = 2; + kVendorSpecific = 3; + } + + enum StatusEnum : enum8 { + kUpdateAvailable = 0; + kBusy = 1; + kNotAvailable = 2; + kDownloadProtocolNotSupported = 3; + } + + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct QueryImageRequest { + vendor_id vendorID = 0; + int16u productID = 1; + int32u softwareVersion = 2; + DownloadProtocolEnum protocolsSupported[] = 3; + optional int16u hardwareVersion = 4; + optional char_string<2> location = 5; + optional boolean requestorCanConsent = 6; + optional octet_string<512> metadataForProvider = 7; + } + + response struct QueryImageResponse = 1 { + StatusEnum status = 0; + optional int32u delayedActionTime = 1; + optional char_string<256> imageURI = 2; + optional int32u softwareVersion = 3; + optional char_string<64> softwareVersionString = 4; + optional octet_string<32> updateToken = 5; + optional boolean userConsentNeeded = 6; + optional octet_string<512> metadataForRequestor = 7; + } + + request struct ApplyUpdateRequestRequest { + octet_string<32> updateToken = 0; + int32u newVersion = 1; + } + + response struct ApplyUpdateResponse = 3 { + ApplyUpdateActionEnum action = 0; + int32u delayedActionTime = 1; + } + + request struct NotifyUpdateAppliedRequest { + octet_string<32> updateToken = 0; + int32u softwareVersion = 1; + } + + /** Determine availability of a new Software Image */ + command QueryImage(QueryImageRequest): QueryImageResponse = 0; + /** Determine next action to take for a downloaded Software Image */ + command ApplyUpdateRequest(ApplyUpdateRequestRequest): ApplyUpdateResponse = 2; + /** Notify OTA Provider that an update was applied */ + command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4; +} + +/** Provides an interface for downloading and applying OTA software updates */ +cluster OtaSoftwareUpdateRequestor = 42 { + revision 1; // NOTE: Default/not specifically set + + enum AnnouncementReasonEnum : enum8 { + kSimpleAnnouncement = 0; + kUpdateAvailable = 1; + kUrgentUpdateAvailable = 2; + } + + enum ChangeReasonEnum : enum8 { + kUnknown = 0; + kSuccess = 1; + kFailure = 2; + kTimeOut = 3; + kDelayByProvider = 4; + } + + enum UpdateStateEnum : enum8 { + kUnknown = 0; + kIdle = 1; + kQuerying = 2; + kDelayedOnQuery = 3; + kDownloading = 4; + kApplying = 5; + kDelayedOnApply = 6; + kRollingBack = 7; + kDelayedOnUserConsent = 8; + } + + fabric_scoped struct ProviderLocation { + node_id providerNodeID = 1; + endpoint_no endpoint = 2; + fabric_idx fabricIndex = 254; + } + + info event StateTransition = 0 { + UpdateStateEnum previousState = 0; + UpdateStateEnum newState = 1; + ChangeReasonEnum reason = 2; + nullable int32u targetSoftwareVersion = 3; + } + + critical event VersionApplied = 1 { + int32u softwareVersion = 0; + int16u productID = 1; + } + + info event DownloadError = 2 { + int32u softwareVersion = 0; + int64u bytesDownloaded = 1; + nullable int8u progressPercent = 2; + nullable int64s platformCode = 3; + } + + attribute access(write: administer) ProviderLocation defaultOTAProviders[] = 0; + readonly attribute boolean updatePossible = 1; + readonly attribute UpdateStateEnum updateState = 2; + readonly attribute nullable int8u updateStateProgress = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AnnounceOTAProviderRequest { + node_id providerNodeID = 0; + vendor_id vendorID = 1; + AnnouncementReasonEnum announcementReason = 2; + optional octet_string<512> metadataForNode = 3; + endpoint_no endpoint = 4; + } + + /** Announce the presence of an OTA Provider */ + command AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0; +} + +/** This cluster is used to manage global aspects of the Commissioning flow. */ +cluster GeneralCommissioning = 48 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningErrorEnum : enum8 { + kOK = 0; + kValueOutsideRange = 1; + kInvalidAuthentication = 2; + kNoFailSafe = 3; + kBusyWithOtherAdmin = 4; + kRequiredTCNotAccepted = 5; + kTCAcknowledgementsNotReceived = 6; + kTCMinVersionNotMet = 7; + } + + enum RegulatoryLocationTypeEnum : enum8 { + kIndoor = 0; + kOutdoor = 1; + kIndoorOutdoor = 2; + } + + bitmap Feature : bitmap32 { + kTermsAndConditions = 0x1; + } + + struct BasicCommissioningInfo { + int16u failSafeExpiryLengthSeconds = 0; + int16u maxCumulativeFailsafeSeconds = 1; + } + + attribute access(write: administer) int64u breadcrumb = 0; + readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; + readonly attribute RegulatoryLocationTypeEnum regulatoryConfig = 2; + readonly attribute RegulatoryLocationTypeEnum locationCapability = 3; + readonly attribute boolean supportsConcurrentConnection = 4; + provisional readonly attribute access(read: administer) optional int16u TCAcceptedVersion = 5; + provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; + provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; + provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ArmFailSafeRequest { + int16u expiryLengthSeconds = 0; + int64u breadcrumb = 1; + } + + response struct ArmFailSafeResponse = 1 { + CommissioningErrorEnum errorCode = 0; + char_string<128> debugText = 1; + } + + request struct SetRegulatoryConfigRequest { + RegulatoryLocationTypeEnum newRegulatoryConfig = 0; + char_string<2> countryCode = 1; + int64u breadcrumb = 2; + } + + response struct SetRegulatoryConfigResponse = 3 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + response struct CommissioningCompleteResponse = 5 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + request struct SetTCAcknowledgementsRequest { + int16u TCVersion = 0; + bitmap16 TCUserResponse = 1; + } + + response struct SetTCAcknowledgementsResponse = 7 { + CommissioningErrorEnum errorCode = 0; + } + + /** Arm the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock */ + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + /** Set the regulatory configuration to be used during commissioning */ + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + /** Signals the Server that the Client has successfully completed all steps of Commissioning/Recofiguration needed during fail-safe period. */ + fabric command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; + /** This command sets the user acknowledgements received in the Enhanced Setup Flow Terms and Conditions into the node. */ + command access(invoke: administer) SetTCAcknowledgements(SetTCAcknowledgementsRequest): SetTCAcknowledgementsResponse = 6; +} + +/** Functionality to configure, enable, disable network credentials and access on a Matter device. */ +cluster NetworkCommissioning = 49 { + revision 1; // NOTE: Default/not specifically set + + enum NetworkCommissioningStatusEnum : enum8 { + kSuccess = 0; + kOutOfRange = 1; + kBoundsExceeded = 2; + kNetworkIDNotFound = 3; + kDuplicateNetworkID = 4; + kNetworkNotFound = 5; + kRegulatoryError = 6; + kAuthFailure = 7; + kUnsupportedSecurity = 8; + kOtherConnectionFailure = 9; + kIPV6Failed = 10; + kIPBindFailed = 11; + kUnknownError = 12; + } + + enum WiFiBandEnum : enum8 { + k2G4 = 0; + k3G65 = 1; + k5G = 2; + k6G = 3; + k60G = 4; + k1G = 5; + } + + bitmap Feature : bitmap32 { + kWiFiNetworkInterface = 0x1; + kThreadNetworkInterface = 0x2; + kEthernetNetworkInterface = 0x4; + kPerDeviceCredentials = 0x8; + } + + bitmap ThreadCapabilitiesBitmap : bitmap16 { + kIsBorderRouterCapable = 0x1; + kIsRouterCapable = 0x2; + kIsSleepyEndDeviceCapable = 0x4; + kIsFullThreadDevice = 0x8; + kIsSynchronizedSleepyEndDeviceCapable = 0x10; + } + + bitmap WiFiSecurityBitmap : bitmap8 { + kUnencrypted = 0x1; + kWEP = 0x2; + kWPAPersonal = 0x4; + kWPA2Personal = 0x8; + kWPA3Personal = 0x10; + kWPA3MatterPDC = 0x20; + } + + struct NetworkInfoStruct { + octet_string<32> networkID = 0; + boolean connected = 1; + optional nullable octet_string<20> networkIdentifier = 2; + optional nullable octet_string<20> clientIdentifier = 3; + } + + struct ThreadInterfaceScanResultStruct { + int16u panId = 0; + int64u extendedPanId = 1; + char_string<16> networkName = 2; + int16u channel = 3; + int8u version = 4; + octet_string<8> extendedAddress = 5; + int8s rssi = 6; + int8u lqi = 7; + } + + struct WiFiInterfaceScanResultStruct { + WiFiSecurityBitmap security = 0; + octet_string<32> ssid = 1; + octet_string<6> bssid = 2; + int16u channel = 3; + WiFiBandEnum wiFiBand = 4; + int8s rssi = 5; + } + + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfoStruct networks[] = 1; + readonly attribute optional int8u scanMaxTimeSeconds = 2; + readonly attribute optional int8u connectMaxTimeSeconds = 3; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatusEnum lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + provisional readonly attribute optional WiFiBandEnum supportedWiFiBands[] = 8; + provisional readonly attribute optional ThreadCapabilitiesBitmap supportedThreadFeatures = 9; + provisional readonly attribute optional int16u threadVersion = 10; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ScanNetworksRequest { + optional nullable octet_string<32> ssid = 0; + optional int64u breadcrumb = 1; + } + + response struct ScanNetworksResponse = 1 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + optional WiFiInterfaceScanResultStruct wiFiScanResults[] = 2; + optional ThreadInterfaceScanResultStruct threadScanResults[] = 3; + } + + request struct AddOrUpdateWiFiNetworkRequest { + octet_string<32> ssid = 0; + octet_string<64> credentials = 1; + optional int64u breadcrumb = 2; + optional octet_string<140> networkIdentity = 3; + optional octet_string<20> clientIdentifier = 4; + optional octet_string<32> possessionNonce = 5; + } + + request struct AddOrUpdateThreadNetworkRequest { + octet_string<254> operationalDataset = 0; + optional int64u breadcrumb = 1; + } + + request struct RemoveNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct NetworkConfigResponse = 5 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string<512> debugText = 1; + optional int8u networkIndex = 2; + optional octet_string<140> clientIdentity = 3; + optional octet_string<64> possessionSignature = 4; + } + + request struct ConnectNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct ConnectNetworkResponse = 7 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + nullable int32s errorValue = 2; + } + + request struct ReorderNetworkRequest { + octet_string<32> networkID = 0; + int8u networkIndex = 1; + optional int64u breadcrumb = 2; + } + + request struct QueryIdentityRequest { + octet_string<20> keyIdentifier = 0; + optional octet_string<32> possessionNonce = 1; + } + + response struct QueryIdentityResponse = 10 { + octet_string<140> identity = 0; + optional octet_string<64> possessionSignature = 1; + } + + /** Detemine the set of networks the device sees as available. */ + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + /** Add or update the credentials for a given Wi-Fi network. */ + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + /** Add or update the credentials for a given Thread network. */ + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + /** Remove the definition of a given network (including its credentials). */ + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + /** Connect to the specified network, using previously-defined credentials. */ + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + /** Modify the order in which networks will be presented in the Networks attribute. */ + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + /** Retrieve details about and optionally proof of possession of a network client identity. */ + command access(invoke: administer) QueryIdentity(QueryIdentityRequest): QueryIdentityResponse = 9; +} + +/** The cluster provides commands for retrieving unstructured diagnostic logs from a Node that may be used to aid in diagnostics. */ +cluster DiagnosticLogs = 50 { + revision 1; // NOTE: Default/not specifically set + + enum IntentEnum : enum8 { + kEndUserSupport = 0; + kNetworkDiag = 1; + kCrashLogs = 2; + } + + enum StatusEnum : enum8 { + kSuccess = 0; + kExhausted = 1; + kNoLogs = 2; + kBusy = 3; + kDenied = 4; + } + + enum TransferProtocolEnum : enum8 { + kResponsePayload = 0; + kBDX = 1; + } + + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RetrieveLogsRequestRequest { + IntentEnum intent = 0; + TransferProtocolEnum requestedProtocol = 1; + optional char_string<32> transferFileDesignator = 2; + } + + response struct RetrieveLogsResponse = 1 { + StatusEnum status = 0; + long_octet_string logContent = 1; + optional epoch_us UTCTimeStamp = 2; + optional systime_us timeSinceBoot = 3; + } + + /** Retrieving diagnostic logs from a Node */ + command RetrieveLogsRequest(RetrieveLogsRequestRequest): RetrieveLogsResponse = 0; +} + +/** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster GeneralDiagnostics = 51 { + revision 2; + + enum BootReasonEnum : enum8 { + kUnspecified = 0; + kPowerOnReboot = 1; + kBrownOutReset = 2; + kSoftwareWatchdogReset = 3; + kHardwareWatchdogReset = 4; + kSoftwareUpdateCompleted = 5; + kSoftwareReset = 6; + } + + enum HardwareFaultEnum : enum8 { + kUnspecified = 0; + kRadio = 1; + kSensor = 2; + kResettableOverTemp = 3; + kNonResettableOverTemp = 4; + kPowerSource = 5; + kVisualDisplayFault = 6; + kAudioOutputFault = 7; + kUserInterfaceFault = 8; + kNonVolatileMemoryError = 9; + kTamperDetected = 10; + } + + enum InterfaceTypeEnum : enum8 { + kUnspecified = 0; + kWiFi = 1; + kEthernet = 2; + kCellular = 3; + kThread = 4; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kHardwareFailure = 1; + kNetworkJammed = 2; + kConnectionFailed = 3; + } + + enum RadioFaultEnum : enum8 { + kUnspecified = 0; + kWiFiFault = 1; + kCellularFault = 2; + kThreadFault = 3; + kNFCFault = 4; + kBLEFault = 5; + kEthernetFault = 6; + } + + bitmap Feature : bitmap32 { + kDataModelTest = 0x1; + } + + struct NetworkInterface { + char_string<32> name = 0; + boolean isOperational = 1; + nullable boolean offPremiseServicesReachableIPv4 = 2; + nullable boolean offPremiseServicesReachableIPv6 = 3; + octet_string<8> hardwareAddress = 4; + octet_string IPv4Addresses[] = 5; + octet_string IPv6Addresses[] = 6; + InterfaceTypeEnum type = 7; + } + + critical event HardwareFaultChange = 0 { + HardwareFaultEnum current[] = 0; + HardwareFaultEnum previous[] = 1; + } + + critical event RadioFaultChange = 1 { + RadioFaultEnum current[] = 0; + RadioFaultEnum previous[] = 1; + } + + critical event NetworkFaultChange = 2 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + critical event BootReason = 3 { + BootReasonEnum bootReason = 0; + } + + readonly attribute NetworkInterface networkInterfaces[] = 0; + readonly attribute int16u rebootCount = 1; + readonly attribute optional int64u upTime = 2; + readonly attribute optional int32u totalOperationalHours = 3; + readonly attribute optional BootReasonEnum bootReason = 4; + readonly attribute optional HardwareFaultEnum activeHardwareFaults[] = 5; + readonly attribute optional RadioFaultEnum activeRadioFaults[] = 6; + readonly attribute optional NetworkFaultEnum activeNetworkFaults[] = 7; + readonly attribute boolean testEventTriggersEnabled = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct TestEventTriggerRequest { + octet_string<16> enableKey = 0; + int64u eventTrigger = 1; + } + + response struct TimeSnapshotResponse = 2 { + systime_ms systemTimeMs = 0; + nullable posix_ms posixTimeMs = 1; + } + + request struct PayloadTestRequestRequest { + octet_string<16> enableKey = 0; + int8u value = 1; + int16u count = 2; + } + + response struct PayloadTestResponse = 4 { + octet_string payload = 0; + } + + /** Provide a means for certification tests to trigger some test-plan-specific events */ + command access(invoke: manage) TestEventTrigger(TestEventTriggerRequest): DefaultSuccess = 0; + /** Take a snapshot of system time and epoch time. */ + command TimeSnapshot(): TimeSnapshotResponse = 1; + /** Request a variable length payload response. */ + command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; +} + +/** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster SoftwareDiagnostics = 52 { + revision 1; // NOTE: Default/not specifically set + + bitmap Feature : bitmap32 { + kWatermarks = 0x1; + } + + struct ThreadMetricsStruct { + int64u id = 0; + optional char_string<8> name = 1; + optional int32u stackFreeCurrent = 2; + optional int32u stackFreeMinimum = 3; + optional int32u stackSize = 4; + } + + info event SoftwareFault = 0 { + int64u id = 0; + optional char_string name = 1; + optional octet_string faultRecording = 2; + } + + readonly attribute optional ThreadMetricsStruct threadMetrics[] = 0; + readonly attribute optional int64u currentHeapFree = 1; + readonly attribute optional int64u currentHeapUsed = 2; + readonly attribute optional int64u currentHeapHighWatermark = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the values: The StackFreeMinimum field of the ThreadMetrics attribute, CurrentHeapHighWaterMark attribute. */ + command access(invoke: manage) ResetWatermarks(): DefaultSuccess = 0; +} + +/** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ +cluster ThreadNetworkDiagnostics = 53 { + revision 2; + + enum ConnectionStatusEnum : enum8 { + kConnected = 0; + kNotConnected = 1; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kLinkDown = 1; + kHardwareFailure = 2; + kNetworkJammed = 3; + } + + enum RoutingRoleEnum : enum8 { + kUnspecified = 0; + kUnassigned = 1; + kSleepyEndDevice = 2; + kEndDevice = 3; + kREED = 4; + kRouter = 5; + kLeader = 6; + } + + bitmap Feature : bitmap32 { + kPacketCounts = 0x1; + kErrorCounts = 0x2; + kMLECounts = 0x4; + kMACCounts = 0x8; + } + + struct NeighborTableStruct { + int64u extAddress = 0; + int32u age = 1; + int16u rloc16 = 2; + int32u linkFrameCounter = 3; + int32u mleFrameCounter = 4; + int8u lqi = 5; + nullable int8s averageRssi = 6; + nullable int8s lastRssi = 7; + int8u frameErrorRate = 8; + int8u messageErrorRate = 9; + boolean rxOnWhenIdle = 10; + boolean fullThreadDevice = 11; + boolean fullNetworkData = 12; + boolean isChild = 13; + } + + struct OperationalDatasetComponents { + boolean activeTimestampPresent = 0; + boolean pendingTimestampPresent = 1; + boolean masterKeyPresent = 2; + boolean networkNamePresent = 3; + boolean extendedPanIdPresent = 4; + boolean meshLocalPrefixPresent = 5; + boolean delayPresent = 6; + boolean panIdPresent = 7; + boolean channelPresent = 8; + boolean pskcPresent = 9; + boolean securityPolicyPresent = 10; + boolean channelMaskPresent = 11; + } + + struct RouteTableStruct { + int64u extAddress = 0; + int16u rloc16 = 1; + int8u routerId = 2; + int8u nextHop = 3; + int8u pathCost = 4; + int8u LQIIn = 5; + int8u LQIOut = 6; + int8u age = 7; + boolean allocated = 8; + boolean linkEstablished = 9; + } + + struct SecurityPolicy { + int16u rotationTime = 0; + int16u flags = 1; + } + + info event ConnectionStatus = 0 { + ConnectionStatusEnum connectionStatus = 0; + } + + info event NetworkFaultChange = 1 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + readonly attribute nullable int16u channel = 0; + readonly attribute nullable RoutingRoleEnum routingRole = 1; + readonly attribute nullable char_string<16> networkName = 2; + readonly attribute nullable int16u panId = 3; + readonly attribute nullable int64u extendedPanId = 4; + readonly attribute nullable octet_string<17> meshLocalPrefix = 5; + readonly attribute optional int64u overrunCount = 6; + readonly attribute NeighborTableStruct neighborTable[] = 7; + readonly attribute RouteTableStruct routeTable[] = 8; + readonly attribute nullable int32u partitionId = 9; + readonly attribute nullable int16u weighting = 10; + readonly attribute nullable int16u dataVersion = 11; + readonly attribute nullable int16u stableDataVersion = 12; + readonly attribute nullable int8u leaderRouterId = 13; + readonly attribute optional int16u detachedRoleCount = 14; + readonly attribute optional int16u childRoleCount = 15; + readonly attribute optional int16u routerRoleCount = 16; + readonly attribute optional int16u leaderRoleCount = 17; + readonly attribute optional int16u attachAttemptCount = 18; + readonly attribute optional int16u partitionIdChangeCount = 19; + readonly attribute optional int16u betterPartitionAttachAttemptCount = 20; + readonly attribute optional int16u parentChangeCount = 21; + readonly attribute optional int32u txTotalCount = 22; + readonly attribute optional int32u txUnicastCount = 23; + readonly attribute optional int32u txBroadcastCount = 24; + readonly attribute optional int32u txAckRequestedCount = 25; + readonly attribute optional int32u txAckedCount = 26; + readonly attribute optional int32u txNoAckRequestedCount = 27; + readonly attribute optional int32u txDataCount = 28; + readonly attribute optional int32u txDataPollCount = 29; + readonly attribute optional int32u txBeaconCount = 30; + readonly attribute optional int32u txBeaconRequestCount = 31; + readonly attribute optional int32u txOtherCount = 32; + readonly attribute optional int32u txRetryCount = 33; + readonly attribute optional int32u txDirectMaxRetryExpiryCount = 34; + readonly attribute optional int32u txIndirectMaxRetryExpiryCount = 35; + readonly attribute optional int32u txErrCcaCount = 36; + readonly attribute optional int32u txErrAbortCount = 37; + readonly attribute optional int32u txErrBusyChannelCount = 38; + readonly attribute optional int32u rxTotalCount = 39; + readonly attribute optional int32u rxUnicastCount = 40; + readonly attribute optional int32u rxBroadcastCount = 41; + readonly attribute optional int32u rxDataCount = 42; + readonly attribute optional int32u rxDataPollCount = 43; + readonly attribute optional int32u rxBeaconCount = 44; + readonly attribute optional int32u rxBeaconRequestCount = 45; + readonly attribute optional int32u rxOtherCount = 46; + readonly attribute optional int32u rxAddressFilteredCount = 47; + readonly attribute optional int32u rxDestAddrFilteredCount = 48; + readonly attribute optional int32u rxDuplicatedCount = 49; + readonly attribute optional int32u rxErrNoFrameCount = 50; + readonly attribute optional int32u rxErrUnknownNeighborCount = 51; + readonly attribute optional int32u rxErrInvalidSrcAddrCount = 52; + readonly attribute optional int32u rxErrSecCount = 53; + readonly attribute optional int32u rxErrFcsCount = 54; + readonly attribute optional int32u rxErrOtherCount = 55; + readonly attribute optional nullable int64u activeTimestamp = 56; + readonly attribute optional nullable int64u pendingTimestamp = 57; + readonly attribute optional nullable int32u delay = 58; + readonly attribute nullable SecurityPolicy securityPolicy = 59; + readonly attribute nullable octet_string<4> channelPage0Mask = 60; + readonly attribute nullable OperationalDatasetComponents operationalDatasetComponents = 61; + readonly attribute NetworkFaultEnum activeNetworkFaultsList[] = 62; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the OverrunCount attributes to 0 */ + command access(invoke: manage) ResetCounts(): DefaultSuccess = 0; +} + +/** The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster WiFiNetworkDiagnostics = 54 { + revision 1; // NOTE: Default/not specifically set + + enum AssociationFailureCauseEnum : enum8 { + kUnknown = 0; + kAssociationFailed = 1; + kAuthenticationFailed = 2; + kSsidNotFound = 3; + } + + enum ConnectionStatusEnum : enum8 { + kConnected = 0; + kNotConnected = 1; + } + + enum SecurityTypeEnum : enum8 { + kUnspecified = 0; + kNone = 1; + kWEP = 2; + kWPA = 3; + kWPA2 = 4; + kWPA3 = 5; + } + + enum WiFiVersionEnum : enum8 { + kA = 0; + kB = 1; + kG = 2; + kN = 3; + kAc = 4; + kAx = 5; + kAh = 6; + } + + bitmap Feature : bitmap32 { + kPacketCounts = 0x1; + kErrorCounts = 0x2; + } + + info event Disconnection = 0 { + int16u reasonCode = 0; + } + + info event AssociationFailure = 1 { + AssociationFailureCauseEnum associationFailureCause = 0; + int16u status = 1; + } + + info event ConnectionStatus = 2 { + ConnectionStatusEnum connectionStatus = 0; + } + + readonly attribute nullable octet_string<6> bssid = 0; + readonly attribute nullable SecurityTypeEnum securityType = 1; + readonly attribute nullable WiFiVersionEnum wiFiVersion = 2; + readonly attribute nullable int16u channelNumber = 3; + readonly attribute nullable int8s rssi = 4; + readonly attribute optional nullable int32u beaconLostCount = 5; + readonly attribute optional nullable int32u beaconRxCount = 6; + readonly attribute optional nullable int32u packetMulticastRxCount = 7; + readonly attribute optional nullable int32u packetMulticastTxCount = 8; + readonly attribute optional nullable int32u packetUnicastRxCount = 9; + readonly attribute optional nullable int32u packetUnicastTxCount = 10; + readonly attribute optional nullable int64u currentMaxRate = 11; + readonly attribute optional nullable int64u overrunCount = 12; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the Breacon and Packet related count attributes to 0 */ + command ResetCounts(): DefaultSuccess = 0; +} + +/** The Ethernet Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster EthernetNetworkDiagnostics = 55 { + revision 1; // NOTE: Default/not specifically set + + enum PHYRateEnum : enum8 { + kRate10M = 0; + kRate100M = 1; + kRate1G = 2; + kRate25G = 3; + kRate5G = 4; + kRate10G = 5; + kRate40G = 6; + kRate100G = 7; + kRate200G = 8; + kRate400G = 9; + } + + bitmap Feature : bitmap32 { + kPacketCounts = 0x1; + kErrorCounts = 0x2; + } + + readonly attribute optional nullable PHYRateEnum PHYRate = 0; + readonly attribute optional nullable boolean fullDuplex = 1; + readonly attribute optional int64u packetRxCount = 2; + readonly attribute optional int64u packetTxCount = 3; + readonly attribute optional int64u txErrCount = 4; + readonly attribute optional int64u collisionCount = 5; + readonly attribute optional int64u overrunCount = 6; + readonly attribute optional nullable boolean carrierDetect = 7; + readonly attribute optional int64u timeSinceReset = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the attributes: PacketRxCount, PacketTxCount, TxErrCount, CollisionCount, OverrunCount to 0 */ + command access(invoke: manage) ResetCounts(): DefaultSuccess = 0; +} + +/** Accurate time is required for a number of reasons, including scheduling, display and validating security materials. */ +cluster TimeSynchronization = 56 { + revision 2; + + enum GranularityEnum : enum8 { + kNoTimeGranularity = 0; + kMinutesGranularity = 1; + kSecondsGranularity = 2; + kMillisecondsGranularity = 3; + kMicrosecondsGranularity = 4; + } + + enum StatusCode : enum8 { + kTimeNotAccepted = 2; + } + + enum TimeSourceEnum : enum8 { + kNone = 0; + kUnknown = 1; + kAdmin = 2; + kNodeTimeCluster = 3; + kNonMatterSNTP = 4; + kNonMatterNTP = 5; + kMatterSNTP = 6; + kMatterNTP = 7; + kMixedNTP = 8; + kNonMatterSNTPNTS = 9; + kNonMatterNTPNTS = 10; + kMatterSNTPNTS = 11; + kMatterNTPNTS = 12; + kMixedNTPNTS = 13; + kCloudSource = 14; + kPTP = 15; + kGNSS = 16; + } + + enum TimeZoneDatabaseEnum : enum8 { + kFull = 0; + kPartial = 1; + kNone = 2; + } + + bitmap Feature : bitmap32 { + kTimeZone = 0x1; + kNTPClient = 0x2; + kNTPServer = 0x4; + kTimeSyncClient = 0x8; + } + + struct DSTOffsetStruct { + int32s offset = 0; + epoch_us validStarting = 1; + nullable epoch_us validUntil = 2; + } + + struct FabricScopedTrustedTimeSourceStruct { + node_id nodeID = 0; + endpoint_no endpoint = 1; + } + + struct TimeZoneStruct { + int32s offset = 0; + epoch_us validAt = 1; + optional char_string<64> name = 2; + } + + struct TrustedTimeSourceStruct { + fabric_idx fabricIndex = 0; + node_id nodeID = 1; + endpoint_no endpoint = 2; + } + + info event DSTTableEmpty = 0 { + } + + info event DSTStatus = 1 { + boolean DSTOffsetActive = 0; + } + + info event TimeZoneStatus = 2 { + int32s offset = 0; + optional char_string name = 1; + } + + info event TimeFailure = 3 { + } + + info event MissingTrustedTimeSource = 4 { + } + + readonly attribute nullable epoch_us UTCTime = 0; + readonly attribute GranularityEnum granularity = 1; + readonly attribute optional TimeSourceEnum timeSource = 2; + readonly attribute optional nullable TrustedTimeSourceStruct trustedTimeSource = 3; + readonly attribute optional nullable char_string<128> defaultNTP = 4; + readonly attribute optional TimeZoneStruct timeZone[] = 5; + readonly attribute optional DSTOffsetStruct DSTOffset[] = 6; + readonly attribute optional nullable epoch_us localTime = 7; + readonly attribute optional TimeZoneDatabaseEnum timeZoneDatabase = 8; + readonly attribute optional boolean NTPServerAvailable = 9; + readonly attribute optional int8u timeZoneListMaxSize = 10; + readonly attribute optional int8u DSTOffsetListMaxSize = 11; + readonly attribute optional boolean supportsDNSResolve = 12; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct SetUTCTimeRequest { + epoch_us UTCTime = 0; + GranularityEnum granularity = 1; + optional TimeSourceEnum timeSource = 2; + } + + request struct SetTrustedTimeSourceRequest { + nullable FabricScopedTrustedTimeSourceStruct trustedTimeSource = 0; + } + + request struct SetTimeZoneRequest { + TimeZoneStruct timeZone[] = 0; + } + + response struct SetTimeZoneResponse = 3 { + boolean DSTOffsetRequired = 0; + } + + request struct SetDSTOffsetRequest { + DSTOffsetStruct DSTOffset[] = 0; + } + + request struct SetDefaultNTPRequest { + nullable char_string<128> defaultNTP = 0; + } + + /** This command MAY be issued by Administrator to set the time. */ + command access(invoke: administer) SetUTCTime(SetUTCTimeRequest): DefaultSuccess = 0; + /** This command SHALL set TrustedTimeSource. */ + fabric command access(invoke: administer) SetTrustedTimeSource(SetTrustedTimeSourceRequest): DefaultSuccess = 1; + /** This command SHALL set TimeZone. */ + command access(invoke: manage) SetTimeZone(SetTimeZoneRequest): SetTimeZoneResponse = 2; + /** This command SHALL set DSTOffset. */ + command access(invoke: manage) SetDSTOffset(SetDSTOffsetRequest): DefaultSuccess = 4; + /** This command is used to set DefaultNTP. */ + command access(invoke: administer) SetDefaultNTP(SetDefaultNTPRequest): DefaultSuccess = 5; +} + +/** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices. +Two types of switch devices are supported: latching switch (e.g. rocker switch) and momentary switch (e.g. push button), distinguished with their feature flags. +Interactions with the switch device are exposed as attributes (for the latching switch) and as events (for both types of switches). An interested party MAY subscribe to these attributes/events and thus be informed of the interactions, and can perform actions based on this, for example by sending commands to perform an action such as controlling a light or a window shade. */ +cluster Switch = 59 { + revision 2; + + bitmap Feature : bitmap32 { + kLatchingSwitch = 0x1; + kMomentarySwitch = 0x2; + kMomentarySwitchRelease = 0x4; + kMomentarySwitchLongPress = 0x8; + kMomentarySwitchMultiPress = 0x10; + kActionSwitch = 0x20; + } + + info event SwitchLatched = 0 { + int8u newPosition = 0; + } + + info event InitialPress = 1 { + int8u newPosition = 0; + } + + info event LongPress = 2 { + int8u newPosition = 0; + } + + info event ShortRelease = 3 { + int8u previousPosition = 0; + } + + info event LongRelease = 4 { + int8u previousPosition = 0; + } + + info event MultiPressOngoing = 5 { + int8u newPosition = 0; + int8u currentNumberOfPressesCounted = 1; + } + + info event MultiPressComplete = 6 { + int8u previousPosition = 0; + int8u totalNumberOfPressesCounted = 1; + } + + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute optional int8u multiPressMax = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** Commands to trigger a Node to allow a new Administrator to commission it. */ +cluster AdministratorCommissioning = 60 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningWindowStatusEnum : enum8 { + kWindowNotOpen = 0; + kEnhancedWindowOpen = 1; + kBasicWindowOpen = 2; + } + + enum StatusCode : enum8 { + kBusy = 2; + kPAKEParameterError = 3; + kWindowNotOpen = 4; + } + + bitmap Feature : bitmap32 { + kBasic = 0x1; + } + + readonly attribute CommissioningWindowStatusEnum windowStatus = 0; + readonly attribute nullable fabric_idx adminFabricIndex = 1; + readonly attribute nullable vendor_id adminVendorId = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OpenCommissioningWindowRequest { + int16u commissioningTimeout = 0; + octet_string PAKEPasscodeVerifier = 1; + int16u discriminator = 2; + int32u iterations = 3; + octet_string<32> salt = 4; + } + + request struct OpenBasicCommissioningWindowRequest { + int16u commissioningTimeout = 0; + } + + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using enhanced commissioning method. */ + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using basic commissioning method, if the node supports it. */ + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + /** This command is used by a current Administrator to instruct a Node to revoke any active Open Commissioning Window or Open Basic Commissioning Window command. */ + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; +} + +/** This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the associated Fabrics. */ +cluster OperationalCredentials = 62 { + revision 1; // NOTE: Default/not specifically set + + enum CertificateChainTypeEnum : enum8 { + kDACCertificate = 1; + kPAICertificate = 2; + } + + enum NodeOperationalCertStatusEnum : enum8 { + kOK = 0; + kInvalidPublicKey = 1; + kInvalidNodeOpId = 2; + kInvalidNOC = 3; + kMissingCsr = 4; + kTableFull = 5; + kInvalidAdminSubject = 6; + kFabricConflict = 9; + kLabelConflict = 10; + kInvalidFabricIndex = 11; + } + + fabric_scoped struct FabricDescriptorStruct { + octet_string<65> rootPublicKey = 1; + vendor_id vendorID = 2; + fabric_id fabricID = 3; + node_id nodeID = 4; + char_string<32> label = 5; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct NOCStruct { + fabric_sensitive octet_string noc = 1; + nullable fabric_sensitive octet_string icac = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; + readonly attribute FabricDescriptorStruct fabrics[] = 1; + readonly attribute int8u supportedFabrics = 2; + readonly attribute int8u commissionedFabrics = 3; + readonly attribute octet_string trustedRootCertificates[] = 4; + readonly attribute int8u currentFabricIndex = 5; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AttestationRequestRequest { + octet_string<32> attestationNonce = 0; + } + + response struct AttestationResponse = 1 { + octet_string<900> attestationElements = 0; + octet_string<64> attestationSignature = 1; + } + + request struct CertificateChainRequestRequest { + CertificateChainTypeEnum certificateType = 0; + } + + response struct CertificateChainResponse = 3 { + octet_string<600> certificate = 0; + } + + request struct CSRRequestRequest { + octet_string<32> CSRNonce = 0; + optional boolean isForUpdateNOC = 1; + } + + response struct CSRResponse = 5 { + octet_string NOCSRElements = 0; + octet_string attestationSignature = 1; + } + + request struct AddNOCRequest { + octet_string<400> NOCValue = 0; + optional octet_string<400> ICACValue = 1; + octet_string<16> IPKValue = 2; + int64u caseAdminSubject = 3; + vendor_id adminVendorId = 4; + } + + request struct UpdateNOCRequest { + octet_string NOCValue = 0; + optional octet_string ICACValue = 1; + } + + response struct NOCResponse = 8 { + NodeOperationalCertStatusEnum statusCode = 0; + optional fabric_idx fabricIndex = 1; + optional char_string<128> debugText = 2; + } + + request struct UpdateFabricLabelRequest { + char_string<32> label = 0; + } + + request struct RemoveFabricRequest { + fabric_idx fabricIndex = 0; + } + + request struct AddTrustedRootCertificateRequest { + octet_string rootCACertificate = 0; + } + + /** Sender is requesting attestation information from the receiver. */ + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + /** Sender is requesting a device attestation certificate from the receiver. */ + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + /** Sender is requesting a certificate signing request (CSR) from the receiver. */ + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + /** Sender is requesting to add the new node operational certificates. */ + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + /** Sender is requesting to update the node operational certificates. */ + fabric command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + /** This command SHALL be used by an Administrative Node to set the user-visible Label field for a given Fabric, as reflected by entries in the Fabrics attribute. */ + fabric command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + /** This command is used by Administrative Nodes to remove a given fabric index and delete all associated fabric-scoped data. */ + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + /** This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation. */ + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; +} + +/** The Group Key Management Cluster is the mechanism by which group keys are managed. */ +cluster GroupKeyManagement = 63 { + revision 1; // NOTE: Default/not specifically set + + enum GroupKeySecurityPolicyEnum : enum8 { + kTrustFirst = 0; + kCacheAndSync = 1; + } + + bitmap Feature : bitmap32 { + kCacheAndSync = 0x1; + } + + fabric_scoped struct GroupInfoMapStruct { + group_id groupId = 1; + endpoint_no endpoints[] = 2; + optional char_string<16> groupName = 3; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct GroupKeyMapStruct { + group_id groupId = 1; + int16u groupKeySetID = 2; + fabric_idx fabricIndex = 254; + } + + struct GroupKeySetStruct { + int16u groupKeySetID = 0; + GroupKeySecurityPolicyEnum groupKeySecurityPolicy = 1; + nullable octet_string<16> epochKey0 = 2; + nullable epoch_us epochStartTime0 = 3; + nullable octet_string<16> epochKey1 = 4; + nullable epoch_us epochStartTime1 = 5; + nullable octet_string<16> epochKey2 = 6; + nullable epoch_us epochStartTime2 = 7; + } + + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; + readonly attribute GroupInfoMapStruct groupTable[] = 1; + readonly attribute int16u maxGroupsPerFabric = 2; + readonly attribute int16u maxGroupKeysPerFabric = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct KeySetWriteRequest { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetReadRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadResponse = 2 { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetRemoveRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadAllIndicesResponse = 5 { + int16u groupKeySetIDs[] = 0; + } + + /** Write a new set of keys for the given key set id. */ + fabric command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + /** Read the keys for a given key set id. */ + fabric command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + /** Revoke a Root Key from a Group */ + fabric command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + /** Return the list of Group Key Sets associated with the accessing fabric */ + fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; +} + +/** The Fixed Label Cluster provides a feature for the device to tag an endpoint with zero or more read only +labels. */ +cluster FixedLabel = 64 { + revision 1; // NOTE: Default/not specifically set + + struct LabelStruct { + char_string<16> label = 0; + char_string<16> value = 1; + } + + readonly attribute LabelStruct labelList[] = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** The User Label Cluster provides a feature to tag an endpoint with zero or more labels. */ +cluster UserLabel = 65 { + revision 1; // NOTE: Default/not specifically set + + struct LabelStruct { + char_string<16> label = 0; + char_string<16> value = 1; + } + + attribute access(write: manage) LabelStruct labelList[] = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** Allows servers to ensure that listed clients are notified when a server is available for communication. */ +cluster IcdManagement = 70 { + revision 3; + + enum ClientTypeEnum : enum8 { + kPermanent = 0; + kEphemeral = 1; + } + + enum OperatingModeEnum : enum8 { + kSIT = 0; + kLIT = 1; + } + + bitmap Feature : bitmap32 { + kCheckInProtocolSupport = 0x1; + kUserActiveModeTrigger = 0x2; + kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; + } + + bitmap UserActiveModeTriggerBitmap : bitmap32 { + kPowerCycle = 0x1; + kSettingsMenu = 0x2; + kCustomInstruction = 0x4; + kDeviceManual = 0x8; + kActuateSensor = 0x10; + kActuateSensorSeconds = 0x20; + kActuateSensorTimes = 0x40; + kActuateSensorLightsBlink = 0x80; + kResetButton = 0x100; + kResetButtonLightsBlink = 0x200; + kResetButtonSeconds = 0x400; + kResetButtonTimes = 0x800; + kSetupButton = 0x1000; + kSetupButtonSeconds = 0x2000; + kSetupButtonLightsBlink = 0x4000; + kSetupButtonTimes = 0x8000; + kAppDefinedButton = 0x10000; + } + + fabric_scoped struct MonitoringRegistrationStruct { + fabric_sensitive node_id checkInNodeID = 1; + fabric_sensitive int64u monitoredSubject = 2; + fabric_sensitive ClientTypeEnum clientType = 4; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeDuration = 0; + readonly attribute int32u activeModeDuration = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute access(read: administer) optional MonitoringRegistrationStruct registeredClients[] = 3; + readonly attribute access(read: administer) optional int32u ICDCounter = 4; + readonly attribute optional int16u clientsSupportedPerFabric = 5; + provisional readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6; + provisional readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7; + provisional readonly attribute optional OperatingModeEnum operatingMode = 8; + provisional readonly attribute optional int32u maximumCheckInBackOff = 9; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RegisterClientRequest { + node_id checkInNodeID = 0; + int64u monitoredSubject = 1; + octet_string<16> key = 2; + optional octet_string<16> verificationKey = 3; + ClientTypeEnum clientType = 4; + } + + response struct RegisterClientResponse = 1 { + int32u ICDCounter = 0; + } + + request struct UnregisterClientRequest { + node_id checkInNodeID = 0; + optional octet_string<16> verificationKey = 1; + } + + request struct StayActiveRequestRequest { + int32u stayActiveDuration = 0; + } + + response struct StayActiveResponse = 4 { + int32u promisedActiveDuration = 0; + } + + /** Register a client to the end device */ + fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0; + /** Unregister a client from an end device */ + fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2; + /** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */ + command access(invoke: manage) StayActiveRequest(StayActiveRequestRequest): StayActiveResponse = 3; +} + +/** Attributes and commands for scene configuration and manipulation. */ +provisional cluster ScenesManagement = 98 { + revision 1; + + bitmap CopyModeBitmap : bitmap8 { + kCopyAllScenes = 0x1; + } + + bitmap Feature : bitmap32 { + kSceneNames = 0x1; + } + + struct AttributeValuePairStruct { + attrib_id attributeID = 0; + optional int8u valueUnsigned8 = 1; + optional int8s valueSigned8 = 2; + optional int16u valueUnsigned16 = 3; + optional int16s valueSigned16 = 4; + optional int32u valueUnsigned32 = 5; + optional int32s valueSigned32 = 6; + optional int64u valueUnsigned64 = 7; + optional int64s valueSigned64 = 8; + } + + struct ExtensionFieldSet { + cluster_id clusterID = 0; + AttributeValuePairStruct attributeValueList[] = 1; + } + + fabric_scoped struct SceneInfoStruct { + int8u sceneCount = 0; + fabric_sensitive int8u currentScene = 1; + fabric_sensitive group_id currentGroup = 2; + fabric_sensitive boolean sceneValid = 3; + int8u remainingCapacity = 4; + fabric_idx fabricIndex = 254; + } + + readonly attribute optional nullable node_id lastConfiguredBy = 0; + readonly attribute int16u sceneTableSize = 1; + readonly attribute SceneInfoStruct fabricSceneInfo[] = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AddSceneRequest { + group_id groupID = 0; + int8u sceneID = 1; + int32u transitionTime = 2; + char_string sceneName = 3; + ExtensionFieldSet extensionFieldSets[] = 4; + } + + response struct AddSceneResponse = 0 { + status status = 0; + group_id groupID = 1; + int8u sceneID = 2; + } + + request struct ViewSceneRequest { + group_id groupID = 0; + int8u sceneID = 1; + } + + response struct ViewSceneResponse = 1 { + status status = 0; + group_id groupID = 1; + int8u sceneID = 2; + optional int32u transitionTime = 3; + optional char_string sceneName = 4; + optional ExtensionFieldSet extensionFieldSets[] = 5; + } + + request struct RemoveSceneRequest { + group_id groupID = 0; + int8u sceneID = 1; + } + + response struct RemoveSceneResponse = 2 { + status status = 0; + group_id groupID = 1; + int8u sceneID = 2; + } + + request struct RemoveAllScenesRequest { + group_id groupID = 0; + } + + response struct RemoveAllScenesResponse = 3 { + status status = 0; + group_id groupID = 1; + } + + request struct StoreSceneRequest { + group_id groupID = 0; + int8u sceneID = 1; + } + + response struct StoreSceneResponse = 4 { + status status = 0; + group_id groupID = 1; + int8u sceneID = 2; + } + + request struct RecallSceneRequest { + group_id groupID = 0; + int8u sceneID = 1; + optional nullable int32u transitionTime = 2; + } + + request struct GetSceneMembershipRequest { + group_id groupID = 0; + } + + response struct GetSceneMembershipResponse = 6 { + status status = 0; + nullable int8u capacity = 1; + group_id groupID = 2; + optional int8u sceneList[] = 3; + } + + request struct CopySceneRequest { + CopyModeBitmap mode = 0; + group_id groupIdentifierFrom = 1; + int8u sceneIdentifierFrom = 2; + group_id groupIdentifierTo = 3; + int8u sceneIdentifierTo = 4; + } + + response struct CopySceneResponse = 64 { + status status = 0; + group_id groupIdentifierFrom = 1; + int8u sceneIdentifierFrom = 2; + } + + /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ + fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0; + /** Retrieves the requested scene entry from its Scene table. */ + fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; + /** Removes the requested scene entry, corresponding to the value of the GroupID field, from its Scene Table */ + fabric command access(invoke: manage) RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; + /** Remove all scenes, corresponding to the value of the GroupID field, from its Scene Table */ + fabric command access(invoke: manage) RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; + /** Adds the scene entry into its Scene Table along with all extension field sets corresponding to the current state of other clusters on the same endpoint */ + fabric command access(invoke: manage) StoreScene(StoreSceneRequest): StoreSceneResponse = 4; + /** Set the attributes and corresponding state for each other cluster implemented on the endpoint accordingly to the resquested scene entry in the Scene Table */ + fabric command RecallScene(RecallSceneRequest): DefaultSuccess = 5; + /** Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to get the used scene identifiers within a certain group */ + fabric command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; + /** Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene identifier pair. */ + fabric command CopyScene(CopySceneRequest): CopySceneResponse = 64; +} + +/** Attributes and commands for controlling the color properties of a color-capable light. */ +cluster ColorControl = 768 { + revision 7; + + enum ColorLoopActionEnum : enum8 { + kDeactivate = 0; + kActivateFromColorLoopStartEnhancedHue = 1; + kActivateFromEnhancedCurrentHue = 2; + } + + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; + } + + enum ColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + } + + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; + kUp = 2; + kDown = 3; + } + + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; + } + + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; + } + + enum MoveModeEnum : enum8 { + kStop = 0; + kUp = 1; + kDown = 3; + } + + enum StepModeEnum : enum8 { + kUp = 1; + kDown = 3; + } + + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; + } + + bitmap Feature : bitmap32 { + kHueAndSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; + } + + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + + readonly attribute optional int8u currentHue = 0; + readonly attribute optional int8u currentSaturation = 1; + readonly attribute optional int16u remainingTime = 2; + readonly attribute optional int16u currentX = 3; + readonly attribute optional int16u currentY = 4; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; + readonly attribute optional char_string<254> compensationText = 6; + readonly attribute optional int16u colorTemperatureMireds = 7; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; + readonly attribute nullable int8u numberOfPrimaries = 16; + readonly attribute optional int16u primary1X = 17; + readonly attribute optional int16u primary1Y = 18; + readonly attribute optional nullable int8u primary1Intensity = 19; + readonly attribute optional int16u primary2X = 21; + readonly attribute optional int16u primary2Y = 22; + readonly attribute optional nullable int8u primary2Intensity = 23; + readonly attribute optional int16u primary3X = 25; + readonly attribute optional int16u primary3Y = 26; + readonly attribute optional nullable int8u primary3Intensity = 27; + readonly attribute optional int16u primary4X = 32; + readonly attribute optional int16u primary4Y = 33; + readonly attribute optional nullable int8u primary4Intensity = 34; + readonly attribute optional int16u primary5X = 36; + readonly attribute optional int16u primary5Y = 37; + readonly attribute optional nullable int8u primary5Intensity = 38; + readonly attribute optional int16u primary6X = 40; + readonly attribute optional int16u primary6Y = 41; + readonly attribute optional nullable int8u primary6Intensity = 42; + attribute access(write: manage) optional int16u whitePointX = 48; + attribute access(write: manage) optional int16u whitePointY = 49; + attribute access(write: manage) optional int16u colorPointRX = 50; + attribute access(write: manage) optional int16u colorPointRY = 51; + attribute access(write: manage) optional nullable int8u colorPointRIntensity = 52; + attribute access(write: manage) optional int16u colorPointGX = 54; + attribute access(write: manage) optional int16u colorPointGY = 55; + attribute access(write: manage) optional nullable int8u colorPointGIntensity = 56; + attribute access(write: manage) optional int16u colorPointBX = 58; + attribute access(write: manage) optional int16u colorPointBY = 59; + attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; + readonly attribute optional int16u enhancedCurrentHue = 16384; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; + readonly attribute optional int8u colorLoopActive = 16386; + readonly attribute optional int8u colorLoopDirection = 16387; + readonly attribute optional int16u colorLoopTime = 16388; + readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; + readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; + readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; + readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; + readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; + attribute access(write: manage) optional nullable int16u startUpColorTemperatureMireds = 16400; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct MoveToHueRequest { + int8u hue = 0; + DirectionEnum direction = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct MoveHueRequest { + MoveModeEnum moveMode = 0; + int8u rate = 1; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; + } + + request struct StepHueRequest { + StepModeEnum stepMode = 0; + int8u stepSize = 1; + int8u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct MoveToSaturationRequest { + int8u saturation = 0; + int16u transitionTime = 1; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; + } + + request struct MoveSaturationRequest { + MoveModeEnum moveMode = 0; + int8u rate = 1; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; + } + + request struct StepSaturationRequest { + StepModeEnum stepMode = 0; + int8u stepSize = 1; + int8u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct MoveToHueAndSaturationRequest { + int8u hue = 0; + int8u saturation = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct MoveToColorRequest { + int16u colorX = 0; + int16u colorY = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct MoveColorRequest { + int16s rateX = 0; + int16s rateY = 1; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; + } + + request struct StepColorRequest { + int16s stepX = 0; + int16s stepY = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct MoveToColorTemperatureRequest { + int16u colorTemperatureMireds = 0; + int16u transitionTime = 1; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; + } + + request struct EnhancedMoveToHueRequest { + int16u enhancedHue = 0; + DirectionEnum direction = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct EnhancedMoveHueRequest { + MoveModeEnum moveMode = 0; + int16u rate = 1; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; + } + + request struct EnhancedStepHueRequest { + StepModeEnum stepMode = 0; + int16u stepSize = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct EnhancedMoveToHueAndSaturationRequest { + int16u enhancedHue = 0; + int8u saturation = 1; + int16u transitionTime = 2; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; + } + + request struct ColorLoopSetRequest { + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; + int16u time = 3; + int16u startHue = 4; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; + } + + request struct StopMoveStepRequest { + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; + } + + request struct MoveColorTemperatureRequest { + MoveModeEnum moveMode = 0; + int16u rate = 1; + int16u colorTemperatureMinimumMireds = 2; + int16u colorTemperatureMaximumMireds = 3; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; + } + + request struct StepColorTemperatureRequest { + StepModeEnum stepMode = 0; + int16u stepSize = 1; + int16u transitionTime = 2; + int16u colorTemperatureMinimumMireds = 3; + int16u colorTemperatureMaximumMireds = 4; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; + } + + /** Move to specified hue. */ + command MoveToHue(MoveToHueRequest): DefaultSuccess = 0; + /** Move hue up or down at specified rate. */ + command MoveHue(MoveHueRequest): DefaultSuccess = 1; + /** Step hue up or down by specified size at specified rate. */ + command StepHue(StepHueRequest): DefaultSuccess = 2; + /** Move to specified saturation. */ + command MoveToSaturation(MoveToSaturationRequest): DefaultSuccess = 3; + /** Move saturation up or down at specified rate. */ + command MoveSaturation(MoveSaturationRequest): DefaultSuccess = 4; + /** Step saturation up or down by specified size at specified rate. */ + command StepSaturation(StepSaturationRequest): DefaultSuccess = 5; + /** Move to hue and saturation. */ + command MoveToHueAndSaturation(MoveToHueAndSaturationRequest): DefaultSuccess = 6; + /** Move to specified color. */ + command MoveToColor(MoveToColorRequest): DefaultSuccess = 7; + /** Moves the color. */ + command MoveColor(MoveColorRequest): DefaultSuccess = 8; + /** Steps the lighting to a specific color. */ + command StepColor(StepColorRequest): DefaultSuccess = 9; + /** Move to a specific color temperature. */ + command MoveToColorTemperature(MoveToColorTemperatureRequest): DefaultSuccess = 10; + /** Command description for EnhancedMoveToHue */ + command EnhancedMoveToHue(EnhancedMoveToHueRequest): DefaultSuccess = 64; + /** Command description for EnhancedMoveHue */ + command EnhancedMoveHue(EnhancedMoveHueRequest): DefaultSuccess = 65; + /** Command description for EnhancedStepHue */ + command EnhancedStepHue(EnhancedStepHueRequest): DefaultSuccess = 66; + /** Command description for EnhancedMoveToHueAndSaturation */ + command EnhancedMoveToHueAndSaturation(EnhancedMoveToHueAndSaturationRequest): DefaultSuccess = 67; + /** Command description for ColorLoopSet */ + command ColorLoopSet(ColorLoopSetRequest): DefaultSuccess = 68; + /** Command description for StopMoveStep */ + command StopMoveStep(StopMoveStepRequest): DefaultSuccess = 71; + /** Command description for MoveColorTemperature */ + command MoveColorTemperature(MoveColorTemperatureRequest): DefaultSuccess = 75; + /** Command description for StepColorTemperature */ + command StepColorTemperature(StepColorTemperatureRequest): DefaultSuccess = 76; +} + +endpoint 0 { + device type ma_rootdevice = 22, version 1; + + binding cluster OtaSoftwareUpdateProvider; + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster Binding { + callback attribute binding; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + + server cluster AccessControl { + emits event AccessControlEntryChanged; + emits event AccessControlExtensionChanged; + callback attribute acl; + callback attribute extension; + callback attribute subjectsPerAccessControlEntry; + callback attribute targetsPerAccessControlEntry; + callback attribute accessControlEntriesPerFabric; + callback attribute attributeList; + ram attribute featureMap default = 0; + callback attribute clusterRevision; + } + + server cluster BasicInformation { + emits event StartUp; + emits event ShutDown; + emits event Leave; + callback attribute dataModelRevision; + callback attribute vendorName; + callback attribute vendorID; + callback attribute productName; + callback attribute productID; + persist attribute nodeLabel; + callback attribute location; + callback attribute hardwareVersion; + callback attribute hardwareVersionString; + callback attribute softwareVersion; + callback attribute softwareVersionString; + callback attribute manufacturingDate; + callback attribute partNumber; + callback attribute productURL; + callback attribute productLabel; + callback attribute serialNumber; + persist attribute localConfigDisabled default = 0; + callback attribute uniqueID; + callback attribute capabilityMinima; + callback attribute specificationVersion; + callback attribute maxPathsPerInvoke; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 3; + } + + server cluster OtaSoftwareUpdateRequestor { + emits event StateTransition; + emits event VersionApplied; + emits event DownloadError; + callback attribute defaultOTAProviders; + ram attribute updatePossible default = 1; + ram attribute updateState default = 0; + ram attribute updateStateProgress default = 0; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AnnounceOTAProvider; + } + + server cluster GeneralCommissioning { + ram attribute breadcrumb default = 0x0000000000000000; + callback attribute basicCommissioningInfo; + callback attribute regulatoryConfig; + callback attribute locationCapability; + callback attribute supportsConcurrentConnection; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command ArmFailSafe; + handle command ArmFailSafeResponse; + handle command SetRegulatoryConfig; + handle command SetRegulatoryConfigResponse; + handle command CommissioningComplete; + handle command CommissioningCompleteResponse; + } + + server cluster NetworkCommissioning { + ram attribute maxNetworks; + callback attribute networks; + ram attribute scanMaxTimeSeconds; + ram attribute connectMaxTimeSeconds; + ram attribute interfaceEnabled; + ram attribute lastNetworkingStatus; + ram attribute lastNetworkID; + ram attribute lastConnectErrorValue; + ram attribute featureMap default = 2; + ram attribute clusterRevision default = 1; + + handle command ScanNetworks; + handle command ScanNetworksResponse; + handle command AddOrUpdateWiFiNetwork; + handle command AddOrUpdateThreadNetwork; + handle command RemoveNetwork; + handle command NetworkConfigResponse; + handle command ConnectNetwork; + handle command ConnectNetworkResponse; + handle command ReorderNetwork; + } + + server cluster DiagnosticLogs { + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command RetrieveLogsRequest; + handle command RetrieveLogsResponse; + } + + server cluster GeneralDiagnostics { + emits event BootReason; + callback attribute networkInterfaces; + callback attribute rebootCount; + callback attribute upTime; + callback attribute totalOperationalHours; + callback attribute bootReason; + callback attribute activeHardwareFaults; + callback attribute activeRadioFaults; + callback attribute activeNetworkFaults; + callback attribute testEventTriggersEnabled default = false; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command TestEventTrigger; + handle command TimeSnapshot; + handle command TimeSnapshotResponse; + } + + server cluster SoftwareDiagnostics { + callback attribute threadMetrics; + callback attribute currentHeapFree; + callback attribute currentHeapUsed; + callback attribute currentHeapHighWatermark; + callback attribute featureMap; + ram attribute clusterRevision default = 1; + + handle command ResetWatermarks; + } + + server cluster ThreadNetworkDiagnostics { + callback attribute channel; + callback attribute routingRole; + callback attribute networkName; + callback attribute panId; + callback attribute extendedPanId; + callback attribute meshLocalPrefix; + callback attribute overrunCount; + callback attribute neighborTable; + callback attribute routeTable; + callback attribute partitionId; + callback attribute weighting; + callback attribute dataVersion; + callback attribute stableDataVersion; + callback attribute leaderRouterId; + callback attribute detachedRoleCount; + callback attribute childRoleCount; + callback attribute routerRoleCount; + callback attribute leaderRoleCount; + callback attribute attachAttemptCount; + callback attribute partitionIdChangeCount; + callback attribute betterPartitionAttachAttemptCount; + callback attribute parentChangeCount; + callback attribute txTotalCount; + callback attribute txUnicastCount; + callback attribute txBroadcastCount; + callback attribute txAckRequestedCount; + callback attribute txAckedCount; + callback attribute txNoAckRequestedCount; + callback attribute txDataCount; + callback attribute txDataPollCount; + callback attribute txBeaconCount; + callback attribute txBeaconRequestCount; + callback attribute txOtherCount; + callback attribute txRetryCount; + callback attribute txDirectMaxRetryExpiryCount; + callback attribute txIndirectMaxRetryExpiryCount; + callback attribute txErrCcaCount; + callback attribute txErrAbortCount; + callback attribute txErrBusyChannelCount; + callback attribute rxTotalCount; + callback attribute rxUnicastCount; + callback attribute rxBroadcastCount; + callback attribute rxDataCount; + callback attribute rxDataPollCount; + callback attribute rxBeaconCount; + callback attribute rxBeaconRequestCount; + callback attribute rxOtherCount; + callback attribute rxAddressFilteredCount; + callback attribute rxDestAddrFilteredCount; + callback attribute rxDuplicatedCount; + callback attribute rxErrNoFrameCount; + callback attribute rxErrUnknownNeighborCount; + callback attribute rxErrInvalidSrcAddrCount; + callback attribute rxErrSecCount; + callback attribute rxErrFcsCount; + callback attribute rxErrOtherCount; + callback attribute activeTimestamp; + callback attribute pendingTimestamp; + callback attribute delay; + callback attribute securityPolicy; + callback attribute channelPage0Mask; + callback attribute operationalDatasetComponents; + callback attribute activeNetworkFaultsList; + ram attribute featureMap default = 0x000F; + ram attribute clusterRevision default = 2; + + handle command ResetCounts; + } + + server cluster WiFiNetworkDiagnostics { + emits event Disconnection; + emits event AssociationFailure; + emits event ConnectionStatus; + callback attribute bssid; + callback attribute securityType; + callback attribute wiFiVersion; + callback attribute channelNumber; + callback attribute rssi; + callback attribute beaconLostCount; + callback attribute beaconRxCount; + callback attribute packetMulticastRxCount; + callback attribute packetMulticastTxCount; + callback attribute packetUnicastRxCount; + callback attribute packetUnicastTxCount; + callback attribute currentMaxRate; + callback attribute overrunCount; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 1; + + handle command ResetCounts; + } + + server cluster EthernetNetworkDiagnostics { + callback attribute PHYRate; + callback attribute fullDuplex; + callback attribute packetRxCount; + callback attribute packetTxCount; + callback attribute txErrCount; + callback attribute collisionCount; + callback attribute overrunCount; + callback attribute carrierDetect; + callback attribute timeSinceReset; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 1; + + handle command ResetCounts; + } + + server cluster TimeSynchronization { + emits event DSTTableEmpty; + emits event DSTStatus; + emits event TimeZoneStatus; + emits event TimeFailure; + emits event MissingTrustedTimeSource; + callback attribute UTCTime; + callback attribute granularity; + ram attribute timeSource default = 0x00; + callback attribute trustedTimeSource; + callback attribute defaultNTP; + callback attribute timeZone; + callback attribute DSTOffset; + callback attribute localTime; + ram attribute timeZoneDatabase default = 0; + callback attribute timeZoneListMaxSize; + callback attribute DSTOffsetListMaxSize; + ram attribute supportsDNSResolve default = false; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0x0B; + ram attribute clusterRevision default = 2; + + handle command SetUTCTime; + handle command SetTrustedTimeSource; + handle command SetTimeZone; + handle command SetTimeZoneResponse; + handle command SetDSTOffset; + handle command SetDefaultNTP; + } + + server cluster AdministratorCommissioning { + callback attribute windowStatus; + callback attribute adminFabricIndex; + callback attribute adminVendorId; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command OpenCommissioningWindow; + handle command RevokeCommissioning; + } + + server cluster OperationalCredentials { + callback attribute NOCs; + callback attribute fabrics; + callback attribute supportedFabrics; + callback attribute commissionedFabrics; + callback attribute trustedRootCertificates; + callback attribute currentFabricIndex; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AttestationRequest; + handle command AttestationResponse; + handle command CertificateChainRequest; + handle command CertificateChainResponse; + handle command CSRRequest; + handle command CSRResponse; + handle command AddNOC; + handle command UpdateNOC; + handle command NOCResponse; + handle command UpdateFabricLabel; + handle command RemoveFabric; + handle command AddTrustedRootCertificate; + } + + server cluster GroupKeyManagement { + callback attribute groupKeyMap; + callback attribute groupTable; + callback attribute maxGroupsPerFabric; + callback attribute maxGroupKeysPerFabric; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command KeySetWrite; + handle command KeySetRead; + handle command KeySetReadResponse; + handle command KeySetRemove; + handle command KeySetReadAllIndices; + handle command KeySetReadAllIndicesResponse; + } + + server cluster FixedLabel { + callback attribute labelList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + + server cluster UserLabel { + callback attribute labelList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + + server cluster IcdManagement { + callback attribute idleModeDuration; + callback attribute activeModeDuration; + callback attribute activeModeThreshold; + callback attribute registeredClients; + callback attribute ICDCounter; + callback attribute clientsSupportedPerFabric; + ram attribute userActiveModeTriggerHint default = 0x1115; + ram attribute userActiveModeTriggerInstruction default = "Power Cycle"; + ram attribute operatingMode default = 0; + callback attribute maximumCheckInBackOff; + ram attribute featureMap default = 15; + ram attribute clusterRevision default = 3; + + handle command RegisterClient; + handle command RegisterClientResponse; + handle command UnregisterClient; + handle command StayActiveRequest; + handle command StayActiveResponse; + } +} +endpoint 1 { + device type ma_onofflightswitch = 259, version 1; + + binding cluster Identify; + binding cluster OnOff; + binding cluster ScenesManagement; + binding cluster ColorControl; + + server cluster Identify { + ram attribute identifyTime default = 0x0000; + ram attribute identifyType default = 0x0; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 4; + + handle command Identify; + handle command TriggerEffect; + } + + server cluster Groups { + ram attribute nameSupport; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 4; + + handle command AddGroup; + handle command AddGroupResponse; + handle command ViewGroup; + handle command ViewGroupResponse; + handle command GetGroupMembership; + handle command GetGroupMembershipResponse; + handle command RemoveGroup; + handle command RemoveGroupResponse; + handle command RemoveAllGroups; + handle command AddGroupIfIdentifying; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster Binding { + callback attribute binding; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } +} +endpoint 2 { + device type ma_genericswitch = 15, version 1; + + + server cluster Identify { + ram attribute identifyTime default = 0x0; + ram attribute identifyType default = 0x0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + + handle command Identify; + handle command TriggerEffect; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster Switch { + emits event InitialPress; + ram attribute numberOfPositions default = 2; + ram attribute currentPosition default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 6; + ram attribute clusterRevision default = 2; + } +} + + diff --git a/examples/light-switch-app/light-switch-common/icd-lit-light-switch-app.zap b/examples/light-switch-app/light-switch-common/icd-lit-light-switch-app.zap new file mode 100644 index 0000000000..bc81c51ff7 --- /dev/null +++ b/examples/light-switch-app/light-switch-common/icd-lit-light-switch-app.zap @@ -0,0 +1,5812 @@ +{ + "fileFormat": 2, + "featureLevel": 104, + "creator": "zap", + "keyValuePairs": [ + { + "key": "commandDiscovery", + "value": "1" + }, + { + "key": "defaultResponsePolicy", + "value": "always" + }, + { + "key": "manufacturerCodes", + "value": "0x1002" + } + ], + "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", + "category": "matter", + "version": 1, + "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "category": "matter", + "version": "chip-v1" + } + ], + "endpointTypes": [ + { + "id": 1, + "name": "MA-rootdevice", + "deviceTypeRef": { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice", + "deviceTypeOrder": 0 + }, + "deviceTypes": [ + { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice", + "deviceTypeOrder": 0 + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 22 + ], + "deviceTypeName": "MA-rootdevice", + "deviceTypeCode": 22, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Binding", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Access Control", + "code": 31, + "mfgCode": null, + "define": "ACCESS_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "ACL", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Extension", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "AccessControlEntryChanged", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "AccessControlExtensionChanged", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Basic Information", + "code": 40, + "mfgCode": null, + "define": "BASIC_INFORMATION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DataModelRevision", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NodeLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ManufacturingDate", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartNumber", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductURL", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "long_char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductLabel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SerialNumber", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LocalConfigDisabled", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "CapabilityMinimaStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SpecificationVersion", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxPathsPerInvoke", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StartUp", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "ShutDown", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Leave", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "OTA Software Update Provider", + "code": 41, + "mfgCode": null, + "define": "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "QueryImage", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "QueryImageResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ApplyUpdateRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ApplyUpdateResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NotifyUpdateApplied", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ] + }, + { + "name": "OTA Software Update Requestor", + "code": 42, + "mfgCode": null, + "define": "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AnnounceOTAProvider", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "DefaultOTAProviders", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UpdatePossible", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "UpdateStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateStateProgress", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StateTransition", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "VersionApplied", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "DownloadError", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ArmFailSafe", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ArmFailSafeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfig", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfigResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CommissioningComplete", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommissioningCompleteResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Breadcrumb", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BasicCommissioningInfo", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "BasicCommissioningInfo", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RegulatoryConfig", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LocationCapability", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportsConcurrentConnection", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddOrUpdateWiFiNetwork", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddOrUpdateThreadNetwork", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NetworkConfigResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ConnectNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ConnectNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ReorderNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "MaxNetworks", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Networks", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ScanMaxTimeSeconds", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ConnectMaxTimeSeconds", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "InterfaceEnabled", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkingStatus", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "NetworkCommissioningStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkID", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastConnectErrorValue", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Diagnostic Logs", + "code": 50, + "mfgCode": null, + "define": "DIAGNOSTIC_LOGS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "RetrieveLogsRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RetrieveLogsResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "TestEventTrigger", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshot", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshotResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NetworkInterfaces", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RebootCount", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TotalOperationalHours", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BootReason", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "BootReasonEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveHardwareFaults", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveRadioFaults", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaults", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TestEventTriggersEnabled", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "BootReason", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Software Diagnostics", + "code": 52, + "mfgCode": null, + "define": "SOFTWARE_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetWatermarks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "ThreadMetrics", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapFree", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapUsed", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapHighWatermark", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thread Network Diagnostics", + "code": 53, + "mfgCode": null, + "define": "THREAD_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Channel", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RoutingRole", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "RoutingRoleEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NetworkName", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PanId", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ExtendedPanId", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "MeshLocalPrefix", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NeighborTable", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouteTable", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionId", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Weighting", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DataVersion", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "StableDataVersion", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRouterId", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DetachedRoleCount", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChildRoleCount", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouterRoleCount", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRoleCount", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "AttachAttemptCount", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionIdChangeCount", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BetterPartitionAttachAttemptCount", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ParentChangeCount", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxTotalCount", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxUnicastCount", + "code": 23, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBroadcastCount", + "code": 24, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckRequestedCount", + "code": 25, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckedCount", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxNoAckRequestedCount", + "code": 27, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataCount", + "code": 28, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataPollCount", + "code": 29, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconCount", + "code": 30, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconRequestCount", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxOtherCount", + "code": 32, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxRetryCount", + "code": 33, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDirectMaxRetryExpiryCount", + "code": 34, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxIndirectMaxRetryExpiryCount", + "code": 35, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrCcaCount", + "code": 36, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrAbortCount", + "code": 37, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrBusyChannelCount", + "code": 38, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxTotalCount", + "code": 39, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxUnicastCount", + "code": 40, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBroadcastCount", + "code": 41, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataCount", + "code": 42, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataPollCount", + "code": 43, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconCount", + "code": 44, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconRequestCount", + "code": 45, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxOtherCount", + "code": 46, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxAddressFilteredCount", + "code": 47, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDestAddrFilteredCount", + "code": 48, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDuplicatedCount", + "code": 49, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrNoFrameCount", + "code": 50, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrUnknownNeighborCount", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrInvalidSrcAddrCount", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrSecCount", + "code": 53, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrFcsCount", + "code": 54, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrOtherCount", + "code": 55, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveTimestamp", + "code": 56, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PendingTimestamp", + "code": 57, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Delay", + "code": 58, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SecurityPolicy", + "code": 59, + "mfgCode": null, + "side": "server", + "type": "SecurityPolicy", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChannelPage0Mask", + "code": 60, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OperationalDatasetComponents", + "code": 61, + "mfgCode": null, + "side": "server", + "type": "OperationalDatasetComponents", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaultsList", + "code": 62, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x000F", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Wi-Fi Network Diagnostics", + "code": 54, + "mfgCode": null, + "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "BSSID", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SecurityType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "SecurityTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "WiFiVersion", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "WiFiVersionEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChannelNumber", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RSSI", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int8s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BeaconLostCount", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BeaconRxCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketMulticastRxCount", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketMulticastTxCount", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketUnicastRxCount", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketUnicastTxCount", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentMaxRate", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "Disconnection", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "AssociationFailure", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "ConnectionStatus", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Ethernet Network Diagnostics", + "code": 55, + "mfgCode": null, + "define": "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "PHYRate", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PHYRateEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FullDuplex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PacketRxCount", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PacketTxCount", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrCount", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CollisionCount", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CarrierDetect", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TimeSinceReset", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Time Synchronization", + "code": 56, + "mfgCode": null, + "define": "TIME_SYNCHRONIZATION_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "SetUTCTime", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetTrustedTimeSource", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetTimeZone", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetTimeZoneResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "SetDSTOffset", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetDefaultNTP", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "UTCTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "epoch_us", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Granularity", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "GranularityEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TimeSource", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "TimeSourceEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TrustedTimeSource", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "TrustedTimeSourceStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DefaultNTP", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TimeZone", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DSTOffset", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LocalTime", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "epoch_us", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TimeZoneDatabase", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "TimeZoneDatabaseEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TimeZoneListMaxSize", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DSTOffsetListMaxSize", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportsDNSResolve", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0B", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "DSTTableEmpty", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "DSTStatus", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "TimeZoneStatus", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "TimeFailure", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "MissingTrustedTimeSource", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Administrator Commissioning", + "code": 60, + "mfgCode": null, + "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "OpenCommissioningWindow", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RevokeCommissioning", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "WindowStatus", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "CommissioningWindowStatusEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminFabricIndex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "fabric_idx", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminVendorId", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AttestationRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AttestationResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CertificateChainRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CertificateChainResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CSRRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CSRResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddNOC", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "UpdateNOC", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NOCResponse", + "code": 8, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "UpdateFabricLabel", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveFabric", + "code": 10, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddTrustedRootCertificate", + "code": 11, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NOCs", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Fabrics", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SupportedFabrics", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CommissionedFabrics", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TrustedRootCertificates", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentFabricIndex", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "GroupKeyMap", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GroupTable", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Fixed Label", + "code": 64, + "mfgCode": null, + "define": "FIXED_LABEL_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "LabelList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "User Label", + "code": 65, + "mfgCode": null, + "define": "USER_LABEL_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "LabelList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "ICD Management", + "code": 70, + "mfgCode": null, + "define": "ICD_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "RegisterClient", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RegisterClientResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "UnregisterClient", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StayActiveRequest", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StayActiveResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdleModeDuration", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeDuration", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RegisteredClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ICDCounter", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientsSupportedPerFabric", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UserActiveModeTriggerHint", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "UserActiveModeTriggerBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x1115", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UserActiveModeTriggerInstruction", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "Power Cycle", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OperatingMode", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "OperatingModeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaximumCheckInBackOff", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "15", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + }, + { + "id": 2, + "name": "MA-onofflightswitch", + "deviceTypeRef": { + "code": 259, + "profileId": 259, + "label": "MA-onofflightswitch", + "name": "MA-onofflightswitch", + "deviceTypeOrder": 0 + }, + "deviceTypes": [ + { + "code": 259, + "profileId": 259, + "label": "MA-onofflightswitch", + "name": "MA-onofflightswitch", + "deviceTypeOrder": 0 + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 259 + ], + "deviceTypeName": "MA-onofflightswitch", + "deviceTypeCode": 259, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdentifyTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "IdentifyType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "IdentifyTypeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Groups", + "code": 4, + "mfgCode": null, + "define": "GROUPS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AddGroup", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ViewGroup", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "GetGroupMembership", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "RemoveGroup", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "RemoveAllGroups", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddGroupIfIdentifying", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NameSupport", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "NameSupportBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "On/Off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "Off", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "On", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "Toggle", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Binding", + "code": 30, + "mfgCode": null, + "define": "BINDING_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Binding", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Scenes Management", + "code": 98, + "mfgCode": null, + "define": "SCENES_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "AddScene", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddSceneResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ViewScene", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ViewSceneResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveScene", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "RemoveSceneResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveAllScenes", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "RemoveAllScenesResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StoreScene", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "StoreSceneResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RecallScene", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "GetSceneMembership", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "GetSceneMembershipResponse", + "code": 6, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + } + ] + }, + { + "name": "Color Control", + "code": 768, + "mfgCode": null, + "define": "COLOR_CONTROL_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "MoveToHue", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveHue", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "StepHue", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveToSaturation", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveSaturation", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "StepSaturation", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveToHueAndSaturation", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveToColor", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveColor", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "StepColor", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "MoveToColorTemperature", + "code": 10, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "EnhancedMoveToHue", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "EnhancedMoveHue", + "code": 65, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "EnhancedStepHue", + "code": 66, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "EnhancedMoveToHueAndSaturation", + "code": 67, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ColorLoopSet", + "code": 68, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ] + } + ] + }, + { + "id": 3, + "name": "MA-genericswitch", + "deviceTypeRef": { + "code": 15, + "profileId": 259, + "label": "MA-genericswitch", + "name": "MA-genericswitch", + "deviceTypeOrder": 0 + }, + "deviceTypes": [ + { + "code": 15, + "profileId": 259, + "label": "MA-genericswitch", + "name": "MA-genericswitch", + "deviceTypeOrder": 0 + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 15 + ], + "deviceTypeName": "MA-genericswitch", + "deviceTypeCode": 15, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdentifyTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "IdentifyType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "IdentifyTypeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "NumberOfPositions", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentPosition", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "6", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "InitialPress", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + } + ] + } + ], + "endpoints": [ + { + "endpointTypeName": "MA-rootdevice", + "endpointTypeIndex": 0, + "profileId": 259, + "endpointId": 0, + "networkId": 0, + "parentEndpointIdentifier": null + }, + { + "endpointTypeName": "MA-onofflightswitch", + "endpointTypeIndex": 1, + "profileId": 259, + "endpointId": 1, + "networkId": 0, + "parentEndpointIdentifier": null + }, + { + "endpointTypeName": "MA-genericswitch", + "endpointTypeIndex": 2, + "profileId": 259, + "endpointId": 2, + "networkId": 0, + "parentEndpointIdentifier": null + } + ] +} \ No newline at end of file diff --git a/examples/light-switch-app/qpg/args.gni b/examples/light-switch-app/qpg/args.gni index 9a69cd1695..a6b8b77b72 100644 --- a/examples/light-switch-app/qpg/args.gni +++ b/examples/light-switch-app/qpg/args.gni @@ -32,5 +32,5 @@ chip_stack_lock_tracking = "none" matter_device_vid = "0xFFF1" matter_device_pid = "0x8004" -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/light-switch-app/silabs/BUILD.gn b/examples/light-switch-app/silabs/BUILD.gn index 2602842edf..cbe8a512f8 100644 --- a/examples/light-switch-app/silabs/BUILD.gn +++ b/examples/light-switch-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -38,7 +38,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/light-switch-app/silabs/README.md b/examples/light-switch-app/silabs/README.md index 898f8e8f29..75411dd305 100644 --- a/examples/light-switch-app/silabs/README.md +++ b/examples/light-switch-app/silabs/README.md @@ -263,6 +263,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/light-switch-app/silabs/build_for_wifi_args.gni b/examples/light-switch-app/silabs/build_for_wifi_args.gni index ac70e16a8b..ed368c0248 100644 --- a/examples/light-switch-app/silabs/build_for_wifi_args.gni +++ b/examples/light-switch-app/silabs/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common" diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni index 8dd0974802..4ec1c04a92 100644 --- a/examples/light-switch-app/silabs/openthread.gni +++ b/examples/light-switch-app/silabs/openthread.gni @@ -29,14 +29,17 @@ sl_enable_test_event_trigger = true # ICD Default configurations chip_enable_icd_server = true +chip_enable_icd_lit = true +chip_enable_icd_dsls = true + chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true # Openthread Configuration flags -sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals -sl_ot_active_interval_ms = 500 # 500ms Active Intervals +sl_ot_idle_interval_ms = 2100000 # 35 minutes Idle Intervals +sl_ot_active_interval_ms = 1000 # 1000ms Active Intervals # ICD Matter Configuration flags -sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration -sl_active_mode_duration_ms = 60000 # 60s Active Mode Duration -sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold +sl_idle_mode_duration_s = 1800 # 30min Idle Mode Duration +sl_active_mode_duration_ms = 0 # 0s Active Mode Duration +sl_active_mode_threshold_ms = 5000 # 5s Active Mode Threshold diff --git a/examples/lighting-app-data-mode-no-unique-id/linux/with_pw_rpc.gni b/examples/lighting-app-data-mode-no-unique-id/linux/with_pw_rpc.gni index 0f1ab1ea89..a67251431a 100644 --- a/examples/lighting-app-data-mode-no-unique-id/linux/with_pw_rpc.gni +++ b/examples/lighting-app-data-mode-no-unique-id/linux/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -39,4 +39,3 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true -chip_use_pw_logging = true diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 7527d02f72..e91aec075b 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:90 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:90 - Setup build environment: diff --git a/examples/lighting-app/bouffalolab/bl602/args.gni b/examples/lighting-app/bouffalolab/bl602/args.gni index 0fcb5aac2e..491e87ab3f 100644 --- a/examples/lighting-app/bouffalolab/bl602/args.gni +++ b/examples/lighting-app/bouffalolab/bl602/args.gni @@ -19,8 +19,8 @@ import("${chip_root}/src/platform/bouffalolab/BL602/args.gni") bl_iot_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" chip_detail_logging = false diff --git a/examples/lighting-app/bouffalolab/bl702/args.gni b/examples/lighting-app/bouffalolab/bl702/args.gni index e06c706903..4e999b386d 100644 --- a/examples/lighting-app/bouffalolab/bl702/args.gni +++ b/examples/lighting-app/bouffalolab/bl702/args.gni @@ -19,8 +19,8 @@ import("${chip_root}/src/platform/bouffalolab/BL702/args.gni") bl_iot_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" chip_detail_logging = false diff --git a/examples/lighting-app/bouffalolab/bl702l/args.gni b/examples/lighting-app/bouffalolab/bl702l/args.gni index 3120af1cce..44589ed15f 100644 --- a/examples/lighting-app/bouffalolab/bl702l/args.gni +++ b/examples/lighting-app/bouffalolab/bl702l/args.gni @@ -19,8 +19,8 @@ import("${chip_root}/src/platform/bouffalolab/BL702L/args.gni") bl_iot_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" chip_detail_logging = false diff --git a/examples/lighting-app/esp32/sdkconfig.defaults.esp32p4 b/examples/lighting-app/esp32/sdkconfig.defaults.esp32p4 new file mode 100644 index 0000000000..3211b306b2 --- /dev/null +++ b/examples/lighting-app/esp32/sdkconfig.defaults.esp32p4 @@ -0,0 +1,37 @@ +CONFIG_IDF_TARGET="esp32p4" + +# Flash size and partition +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# Enable BLE Host but use remote controller +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_ENABLE_BT=y + +# Increase main task stack size +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 + +# Disable Wi-Fi Soft AP +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n + +# LwIP +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 + +# mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Matter shell +CONFIG_ENABLE_CHIP_SHELL=y + +# OTA requestor +CONFIG_ENABLE_OTA_REQUESTOR=y + +# Do not deinit BLE after commissioning +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n + +# ESP32-P4 Function EV Board use ESP32C6 as slave device +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y diff --git a/examples/lighting-app/genio/args.gni b/examples/lighting-app/genio/args.gni index e228696537..cbdadf2669 100644 --- a/examples/lighting-app/genio/args.gni +++ b/examples/lighting-app/genio/args.gni @@ -19,8 +19,8 @@ import("${chip_root}/src/platform/mt793x/args.gni") mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" chip_enable_ble = true diff --git a/examples/lighting-app/genio/build_for_wifi_args.gni b/examples/lighting-app/genio/build_for_wifi_args.gni index cb0ea7600a..3001e6648f 100644 --- a/examples/lighting-app/genio/build_for_wifi_args.gni +++ b/examples/lighting-app/genio/build_for_wifi_args.gni @@ -18,5 +18,5 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false import("${chip_root}/src/platform/MT793X/wifi_args.gni") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/lighting-app/linux/with_pw_rpc.gni b/examples/lighting-app/linux/with_pw_rpc.gni index 0f1ab1ea89..a67251431a 100644 --- a/examples/lighting-app/linux/with_pw_rpc.gni +++ b/examples/lighting-app/linux/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -39,4 +39,3 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true -chip_use_pw_logging = true diff --git a/examples/lighting-app/nxp/README.md b/examples/lighting-app/nxp/README.md index e0860a021e..43fd85219f 100644 --- a/examples/lighting-app/nxp/README.md +++ b/examples/lighting-app/nxp/README.md @@ -128,7 +128,7 @@ corresponding to data model target. ### Manufacturing data -Use `chip_with_factory_data=1` in the gn build command to enable factory data. +Use `nxp_use_factory_data=true` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see [Guide for writing manufacturing data on NXP devices](../../../docs/platforms/nxp/nxp_manufacturing_flow.md). diff --git a/examples/lighting-app/nxp/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w0/BUILD.gn index 65a62229a7..b44b45062d 100644 --- a/examples/lighting-app/nxp/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w0/BUILD.gn @@ -99,7 +99,7 @@ k32w0_executable("light_app") { "main/main.cpp", ] - if (chip_with_factory_data == 1 && use_custom_factory_provider == 1) { + if (nxp_use_factory_data && use_custom_factory_provider == 1) { sources += [ "${k32w0_platform_dir}/common/CustomFactoryDataProvider.cpp", "${k32w0_platform_dir}/common/CustomFactoryDataProvider.h", diff --git a/examples/lighting-app/nxp/k32w0/README.md b/examples/lighting-app/nxp/k32w0/README.md index 61f35a3e71..43f25500c1 100644 --- a/examples/lighting-app/nxp/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w0/README.md @@ -256,8 +256,8 @@ Also, in case the OM15082 Expansion Board is not attached to the DK6 board, the build argument (chip_with_OM15082) inside the gn build instruction should be set to zero. The argument chip_with_OM15082 is set to zero by default. -In case that Openthread CLI is needed, chip_with_ot_cli build argument must be -set to 1. +In case that Openthread CLI is needed, `nxp_enable_ot_cli` build argument must +be set to true. In case the board doesn't have 32KHz crystal fitted, one can use the 32KHz free running oscillator as a clock source. In this case one must set the use_fro_32k @@ -348,10 +348,10 @@ CHIPProjectConfig.h. Regarding factory data provider, there are two options: - use the default factory data provider: `FactoryDataProviderImpl` by setting - `chip_with_factory_data=1` in the gn build command. + `nxp_use_factory_data=true` in the gn build command. - use a custom factory data provider: please see [Guide for implementing a custom factory data provider](../../../platform/nxp/k32w0/doc/CustomFactoryDataProvider.md). - This can be enabled when `chip_with_factory_data=1` by setting + This can be enabled when `nxp_use_factory_data=true` by setting `use_custom_factory_provider=1` in the gn build command. ## Flashing and debugging @@ -669,9 +669,9 @@ factory data TLV value. A user can select which default processors to enable: -- `chip_enable_ota_firmware_processor=1` to enable default firmware (app/SSBL) - update processor (enabled by default). -- `chip_enable_ota_factory_data_processor=1` to enable default factory data +- `nxp_enable_ota_firmware_processor=true` to enable default firmware + (app/SSBL) update processor (enabled by default). +- `nxp_enable_ota_factory_data_processor=true` to enable default factory data update processor (disabled by default). The address for storing the custom OTA entry can also be specified: diff --git a/examples/lighting-app/nxp/k32w0/args.gni b/examples/lighting-app/nxp/k32w0/args.gni index 7126cf38ad..da4649ea56 100644 --- a/examples/lighting-app/nxp/k32w0/args.gni +++ b/examples/lighting-app/nxp/k32w0/args.gni @@ -26,6 +26,6 @@ is_debug = false chip_crypto = "platform" chip_crypto_flavor = "NXP-Ultrafast-P256" -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_with_OM15082 = 1 chip_pw_tokenizer_logging = true diff --git a/examples/lighting-app/nxp/k32w1/BUILD.gn b/examples/lighting-app/nxp/k32w1/BUILD.gn index 57a1b7921f..91f0697322 100644 --- a/examples/lighting-app/nxp/k32w1/BUILD.gn +++ b/examples/lighting-app/nxp/k32w1/BUILD.gn @@ -101,7 +101,7 @@ mcxw71_k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", ] - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { include_dirs += [ "${example_platform_dir}/board" ] sources += [ "${example_platform_dir}/board/peripherals.c", @@ -195,7 +195,7 @@ mcxw71_k32w1_executable("light_app") { sources += [ "${example_platform_dir}/rpc/AppRpc.cpp" ] } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ] deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] @@ -218,7 +218,7 @@ mcxw71_k32w1_executable("light_app") { "${chip_root}/src/platform/logging:default", ] - if (chip_config_dimmable_led) { + if (nxp_config_dimmable_led) { defines += [ "LIGHTING_MANAGER_ENABLE_DIMMABLE_LED=1" ] sources += [ "${common_example_dir}/led_widget/include/LedDimmer.h", @@ -246,7 +246,7 @@ mcxw71_k32w1_executable("light_app") { ] } - if (use_smu2_static) { + if (nxp_use_smu2_static) { ldscript = "${example_platform_dir}/app/ldscripts/app.ld" base_ldscript_dir = "${nxp_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc" } else { @@ -263,11 +263,11 @@ mcxw71_k32w1_executable("light_app") { "-T" + rebase_path(ldscript, root_build_dir), ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] } - if (use_smu2_static) { + if (nxp_use_smu2_static) { ldflags += [ "-L" + rebase_path(base_ldscript_dir, root_build_dir) ] } diff --git a/examples/lighting-app/nxp/k32w1/README.md b/examples/lighting-app/nxp/k32w1/README.md index 61cec8077c..0b81a1ac5d 100644 --- a/examples/lighting-app/nxp/k32w1/README.md +++ b/examples/lighting-app/nxp/k32w1/README.md @@ -83,8 +83,8 @@ if changed, the names must be updated in `app.ld`. See `SMU2` memory range size. When compiling the application as an OT Full Thread Device -(`chip_openthread_ftd=true`), using `use_smu2_static=true` gn arg will cause the -following symbols to be moved to `SMU2` area: +(`chip_openthread_ftd=true`), using `nxp_use_smu2_static=true` gn arg will cause +the following symbols to be moved to `SMU2` area: | symbol name | file | | ----------------------------------- | ---------------------------- | @@ -93,19 +93,19 @@ following symbols to be moved to `SMU2` area: | `Server::sServer` | `Server.cpp` | | `ThreadStackManagerImpl::sInstance` | `ThreadStackManagerImpl.cpp` | -Additionally, using `use_smu2_dynamic=true` will cause the OpenThread buffers to -be dynamically allocated from a 13KB `SMU2` range after a successful +Additionally, using `nxp_use_smu2_dynamic=true` will cause the OpenThread +buffers to be dynamically allocated from a 13KB `SMU2` range after a successful commissioning process. -`use_smu2_static` and `use_smu2_dynamic` are set to `true` in the default -example. +`nxp_use_smu2_static` and `nxp_use_smu2_dynamic` are set to `true` in the +default example. ### LED PWM In the default configuration, the onboard RGB LED pins are configured as GPIO pins. In order to enable the dimming feature, the pins need to be configured in PWM mode and synced with channels of the `TPM` (Timer PWM Module). To enable -this feature, compile the application with: `chip_config_dimmable_led=true` +this feature, compile the application with: `nxp_config_dimmable_led=true` If the feature is enabled, the LED brightness can be controlled using `LevelControl` cluster diff --git a/examples/lighting-app/nxp/k32w1/args.gni b/examples/lighting-app/nxp/k32w1/args.gni index 5c854bc1c3..3d026f1fb4 100644 --- a/examples/lighting-app/nxp/k32w1/args.gni +++ b/examples/lighting-app/nxp/k32w1/args.gni @@ -19,7 +19,7 @@ import("${chip_root}/config/standalone/args.gni") nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") nxp_device = "K32W1480" -chip_config_dimmable_led = false +nxp_config_dimmable_led = false chip_enable_ota_requestor = true chip_stack_lock_tracking = "fatal" chip_enable_ble = true @@ -29,11 +29,11 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = true -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_system_config_provide_statistics = false chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -use_smu2_static = true -use_smu2_dynamic = true +nxp_use_smu2_static = true +nxp_use_smu2_dynamic = true diff --git a/examples/lighting-app/nxp/k32w1/with_pw_rpc.gni b/examples/lighting-app/nxp/k32w1/with_pw_rpc.gni index c2dc195054..2afd19aeef 100644 --- a/examples/lighting-app/nxp/k32w1/with_pw_rpc.gni +++ b/examples/lighting-app/nxp/k32w1/with_pw_rpc.gni @@ -31,7 +31,7 @@ chip_system_config_provide_statistics = false chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false cpp_standard = "gnu++17" is_debug = false diff --git a/examples/lighting-app/nxp/mcxw71/BUILD.gn b/examples/lighting-app/nxp/mcxw71/BUILD.gn index f7e9c42b6e..8ee1b50b36 100644 --- a/examples/lighting-app/nxp/mcxw71/BUILD.gn +++ b/examples/lighting-app/nxp/mcxw71/BUILD.gn @@ -101,7 +101,7 @@ mcxw71_k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", ] - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { include_dirs += [ "${example_platform_dir}/board" ] sources += [ "${example_platform_dir}/board/peripherals.c", @@ -198,7 +198,7 @@ mcxw71_k32w1_executable("light_app") { sources += [ "${example_platform_dir}/rpc/AppRpc.cpp" ] } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ] deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] @@ -221,7 +221,7 @@ mcxw71_k32w1_executable("light_app") { "${chip_root}/src/platform/logging:default", ] - if (chip_config_dimmable_led) { + if (nxp_config_dimmable_led) { defines += [ "LIGHTING_MANAGER_ENABLE_DIMMABLE_LED=1" ] sources += [ "${common_example_dir}/led_widget/include/LedDimmer.h", @@ -249,7 +249,7 @@ mcxw71_k32w1_executable("light_app") { ] } - if (use_smu2_static) { + if (nxp_use_smu2_static) { ldscript = "${example_platform_dir}/app/ldscripts/app.ld" base_ldscript_dir = "${nxp_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc" } else { @@ -266,11 +266,11 @@ mcxw71_k32w1_executable("light_app") { "-T" + rebase_path(ldscript, root_build_dir), ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] } - if (use_smu2_static) { + if (nxp_use_smu2_static) { ldflags += [ "-L" + rebase_path(base_ldscript_dir, root_build_dir) ] } diff --git a/examples/lighting-app/nxp/mcxw71/README.md b/examples/lighting-app/nxp/mcxw71/README.md index 3cded8b8be..c9c4007485 100644 --- a/examples/lighting-app/nxp/mcxw71/README.md +++ b/examples/lighting-app/nxp/mcxw71/README.md @@ -83,8 +83,8 @@ if changed, the names must be updated in `app.ld`. See `SMU2` memory range size. When compiling the application as an OT Full Thread Device -(`chip_openthread_ftd=true`), using `use_smu2_static=true` gn arg will cause the -following symbols to be moved to `SMU2` area: +(`chip_openthread_ftd=true`), using `nxp_use_smu2_static=true` gn arg will cause +the following symbols to be moved to `SMU2` area: | symbol name | file | | ----------------------------------- | ---------------------------- | @@ -93,19 +93,19 @@ following symbols to be moved to `SMU2` area: | `Server::sServer` | `Server.cpp` | | `ThreadStackManagerImpl::sInstance` | `ThreadStackManagerImpl.cpp` | -Additionally, using `use_smu2_dynamic=true` will cause the OpenThread buffers to -be dynamically allocated from a 13KB `SMU2` range after a successful +Additionally, using `nxp_use_smu2_dynamic=true` will cause the OpenThread +buffers to be dynamically allocated from a 13KB `SMU2` range after a successful commissioning process. -`use_smu2_static` and `use_smu2_dynamic` are set to `true` in the default -example. +`nxp_use_smu2_static` and `nxp_use_smu2_dynamic` are set to `true` in the +default example. ### LED PWM In the default configuration, the onboard RGB LED pins are configured as GPIO pins. In order to enable the dimming feature, the pins need to be configured in PWM mode and synced with channels of the `TPM` (Timer PWM Module). To enable -this feature, compile the application with: `chip_config_dimmable_led=true` +this feature, compile the application with: `nxp_config_dimmable_led=true` If the feature is enabled, the LED brightness can be controlled using `LevelControl` cluster diff --git a/examples/lighting-app/nxp/mcxw71/args.gni b/examples/lighting-app/nxp/mcxw71/args.gni index 6a27d6605e..6be0421109 100644 --- a/examples/lighting-app/nxp/mcxw71/args.gni +++ b/examples/lighting-app/nxp/mcxw71/args.gni @@ -19,7 +19,7 @@ import("${chip_root}/config/standalone/args.gni") nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") nxp_device = "MCXW716C" -chip_config_dimmable_led = false +nxp_config_dimmable_led = false chip_enable_ota_requestor = true chip_stack_lock_tracking = "fatal" chip_enable_ble = true @@ -29,11 +29,11 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = true -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false chip_system_config_provide_statistics = false chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -use_smu2_static = true -use_smu2_dynamic = true +nxp_use_smu2_static = true +nxp_use_smu2_dynamic = true diff --git a/examples/lighting-app/nxp/mcxw71/with_pw_rpc.gni b/examples/lighting-app/nxp/mcxw71/with_pw_rpc.gni index c2dc195054..2afd19aeef 100644 --- a/examples/lighting-app/nxp/mcxw71/with_pw_rpc.gni +++ b/examples/lighting-app/nxp/mcxw71/with_pw_rpc.gni @@ -31,7 +31,7 @@ chip_system_config_provide_statistics = false chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -chip_with_ot_cli = 0 +nxp_enable_ot_cli = false cpp_standard = "gnu++17" is_debug = false diff --git a/examples/lighting-app/qpg/args.gni b/examples/lighting-app/qpg/args.gni index ea22dfd187..37ca029954 100644 --- a/examples/lighting-app/qpg/args.gni +++ b/examples/lighting-app/qpg/args.gni @@ -30,5 +30,5 @@ chip_stack_lock_tracking = "none" matter_device_vid = "0xFFF1" matter_device_pid = "0x8005" -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/lighting-app/silabs/BUILD.gn b/examples/lighting-app/silabs/BUILD.gn index 55d7d41009..00aa6d9028 100644 --- a/examples/lighting-app/silabs/BUILD.gn +++ b/examples/lighting-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -38,7 +38,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/lighting-app/silabs/README.md b/examples/lighting-app/silabs/README.md index 7052d4f712..b783a6c328 100644 --- a/examples/lighting-app/silabs/README.md +++ b/examples/lighting-app/silabs/README.md @@ -245,6 +245,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/lighting-app/silabs/build_for_wifi_args.gni b/examples/lighting-app/silabs/build_for_wifi_args.gni index 7e33551c30..f8cc0089c8 100644 --- a/examples/lighting-app/silabs/build_for_wifi_args.gni +++ b/examples/lighting-app/silabs/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") # Not needed for the Lighting-app chip_enable_read_client = false diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index 49684770a3..9fb02976f0 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -2672,7 +2672,7 @@ endpoint 1 { ram attribute colorCapabilities default = 0x1F; ram attribute colorTempPhysicalMinMireds default = 0x009A; ram attribute colorTempPhysicalMaxMireds default = 0x01C6; - ram attribute coupleColorTempToLevelMinMireds; + ram attribute coupleColorTempToLevelMinMireds default = 0x009A; persist attribute startUpColorTemperatureMireds default = 0x00FA; callback attribute generatedCommandList; callback attribute acceptedCommandList; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap index 62cc5c49eb..6e7931fbcf 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -5022,7 +5022,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x009A", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index 003a38e52c..1619fc9622 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -2964,7 +2964,7 @@ endpoint 1 { ram attribute colorCapabilities default = 0x1F; ram attribute colorTempPhysicalMinMireds default = 0x009A; ram attribute colorTempPhysicalMaxMireds default = 0x01C6; - ram attribute coupleColorTempToLevelMinMireds; + ram attribute coupleColorTempToLevelMinMireds default = 0x009A; persist attribute startUpColorTemperatureMireds default = 0x00FA; ram attribute featureMap default = 0x1F; ram attribute clusterRevision default = 7; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap index 94397579a0..a0b64b7193 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -4797,7 +4797,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x009A", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/telink/include/CHIPProjectConfig.h b/examples/lighting-app/telink/include/CHIPProjectConfig.h index 830ad45de5..af5f8c6358 100644 --- a/examples/lighting-app/telink/include/CHIPProjectConfig.h +++ b/examples/lighting-app/telink/include/CHIPProjectConfig.h @@ -35,3 +35,9 @@ // Until this is improved in OpenThread we need to increase the retransmission // interval to survive the stall. #define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (1000_ms32) + +// ========== Multicast groups Configuration Overrides ========= +#undef CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC +#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 2 + +#define CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_MAX_SUBJECTS_PER_ENTRY (4 * CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC) diff --git a/examples/lighting-app/telink/prj.conf b/examples/lighting-app/telink/prj.conf index 39eb720b20..9c7bab3e5f 100644 --- a/examples/lighting-app/telink/prj.conf +++ b/examples/lighting-app/telink/prj.conf @@ -31,6 +31,7 @@ CONFIG_BT_DEVICE_NAME="TelinkLight" # Disable Matter OTA DFU CONFIG_CHIP_OTA_REQUESTOR=n CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1 +CONFIG_TELINK_OTA_BUTTON_TEST=n # Disable CHIP shell support CONFIG_CHIP_LIB_SHELL=n diff --git a/examples/lighting-app/tizen/README.md b/examples/lighting-app/tizen/README.md index 28e0d9b2c0..d1b2fe474e 100644 --- a/examples/lighting-app/tizen/README.md +++ b/examples/lighting-app/tizen/README.md @@ -13,7 +13,7 @@ Generating tizen-arm-light ```sh gn gen --check \ --fail-on-unused-args \ - --export-compile-commands \ + --add-export-compile-commands=* \ --root=$PW_PROJECT_ROOT/examples/lighting-app/tizen \ "--args=target_os=\"tizen\" target_cpu=\"arm\" tizen_sdk_root=\"$TIZEN_SDK_ROOT\" tizen_sdk_sysroot=\"$TIZEN_SDK_SYSROOT\"" \ $PW_PROJECT_ROOT/out/tizen-arm-light diff --git a/examples/lighting-app/tizen/src/DBusInterface.cpp b/examples/lighting-app/tizen/src/DBusInterface.cpp index 5484c7daff..4a2aa18122 100644 --- a/examples/lighting-app/tizen/src/DBusInterface.cpp +++ b/examples/lighting-app/tizen/src/DBusInterface.cpp @@ -203,7 +203,8 @@ gboolean DBusInterface::OnColorTemperatureChanged(LightAppColorControl * colorCo data.colorTemperatureMireds = light_app_color_control_get_color_temperature_mireds(colorControl); chip::DeviceLayer::StackLock lock; - ColorControlServer::Instance().moveToColorTempCommand(&handler, path, data); + auto status = ColorControlServer::Instance().moveToColorTempCommand(self->mEndpointId, data); + handler.AddStatus(path, status); return G_DBUS_METHOD_INVOCATION_HANDLED; } diff --git a/examples/lit-icd-app/linux/config/CHIPProjectConfig.h b/examples/lit-icd-app/linux/config/CHIPProjectConfig.h index fd663ffcbc..2de4d03ad7 100644 --- a/examples/lit-icd-app/linux/config/CHIPProjectConfig.h +++ b/examples/lit-icd-app/linux/config/CHIPProjectConfig.h @@ -63,8 +63,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #ifndef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4 #endif diff --git a/examples/lit-icd-app/silabs/BUILD.gn b/examples/lit-icd-app/silabs/BUILD.gn index eb7fa7a09a..8dfa759c2b 100644 --- a/examples/lit-icd-app/silabs/BUILD.gn +++ b/examples/lit-icd-app/silabs/BUILD.gn @@ -19,7 +19,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -39,7 +39,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/lit-icd-app/silabs/README.md b/examples/lit-icd-app/silabs/README.md index 4d1dee045c..1b94dc5b90 100644 --- a/examples/lit-icd-app/silabs/README.md +++ b/examples/lit-icd-app/silabs/README.md @@ -250,6 +250,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/lit-icd-app/silabs/build_for_wifi_args.gni b/examples/lit-icd-app/silabs/build_for_wifi_args.gni index 6ef009e906..57843c9b54 100644 --- a/examples/lit-icd-app/silabs/build_for_wifi_args.gni +++ b/examples/lit-icd-app/silabs/build_for_wifi_args.gni @@ -18,7 +18,7 @@ import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/lit-icd-app/lit-icd-common" @@ -30,6 +30,7 @@ chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true chip_enable_icd_lit = true +chip_enable_icd_dsls = true # ICD Matter Configuration flags sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index e84e7be8ed..c09176354a 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -34,6 +34,7 @@ chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true chip_icd_report_on_active_mode = true chip_enable_icd_lit = true +chip_enable_icd_dsls = true # Openthread Configuration flags sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval diff --git a/examples/lit-icd-app/silabs/src/ShellCommands.cpp b/examples/lit-icd-app/silabs/src/ShellCommands.cpp deleted file mode 100644 index 52f305eb27..0000000000 --- a/examples/lit-icd-app/silabs/src/ShellCommands.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#if defined(ENABLE_CHIP_SHELL) - -#include "ShellCommands.h" -#include -#include -#include - -using namespace chip; -using namespace chip::app; - -namespace LitICDCommands { - -using Shell::Engine; -using Shell::shell_command_t; -using Shell::streamer_get; -using Shell::streamer_printf; - -/** - * @brief configures lit icd matter shell - */ -void RegisterSwitchCommands() -{ - // Blank structure for now - static const shell_command_t sLitICDCommand = {}; - - Engine::Root().RegisterCommands(&sLitICDCommand, 1); -} - -} // namespace LitICDCommands - -#endif // ENABLE_CHIP_SHELL diff --git a/examples/lock-app/genio/args.gni b/examples/lock-app/genio/args.gni index ddbfb9fa47..b684adc4a6 100644 --- a/examples/lock-app/genio/args.gni +++ b/examples/lock-app/genio/args.gni @@ -18,8 +18,8 @@ import("${chip_root}/src/platform/mt793x/args.gni") mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" chip_enable_ble = true diff --git a/examples/lock-app/genio/build_for_wifi_args.gni b/examples/lock-app/genio/build_for_wifi_args.gni index cb0ea7600a..3001e6648f 100644 --- a/examples/lock-app/genio/build_for_wifi_args.gni +++ b/examples/lock-app/genio/build_for_wifi_args.gni @@ -18,5 +18,5 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false import("${chip_root}/src/platform/MT793X/wifi_args.gni") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/lock-app/nxp/README.md b/examples/lock-app/nxp/README.md index a758ef50d7..9bbd88a17e 100644 --- a/examples/lock-app/nxp/README.md +++ b/examples/lock-app/nxp/README.md @@ -123,7 +123,7 @@ corresponding to data model target. ### Manufacturing data -Use `chip_with_factory_data=1` in the gn build command to enable factory data. +Use `nxp_use_factory_data=true` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see [Guide for writing manufacturing data on NXP devices](../../../docs/platforms/nxp/nxp_manufacturing_flow.md). diff --git a/examples/lock-app/nxp/k32w1/BUILD.gn b/examples/lock-app/nxp/k32w1/BUILD.gn index c10cc05475..d54a69400b 100644 --- a/examples/lock-app/nxp/k32w1/BUILD.gn +++ b/examples/lock-app/nxp/k32w1/BUILD.gn @@ -85,7 +85,7 @@ mcxw71_k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", ] - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { include_dirs += [ "${example_platform_dir}/board" ] sources += [ "${example_platform_dir}/board/peripherals.c", @@ -124,7 +124,7 @@ mcxw71_k32w1_executable("lock_app") { defines += [ "CONFIG_DIAG_LOGS_DEMO=1" ] } - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { defines += [ "CONFIG_LOW_POWER=1" ] } else { defines += [ @@ -168,17 +168,17 @@ mcxw71_k32w1_executable("lock_app") { "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", ] - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { sources += [ "${common_example_dir}/low_power/source/LowPower.cpp" ] } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ] deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] } - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", @@ -248,7 +248,7 @@ mcxw71_k32w1_executable("lock_app") { "../common/main/main.cpp", ] - if (chip_with_low_power == 0) { + if (!nxp_use_low_power) { sources += [ "${common_example_dir}/ui_feedback/source/LedManager.cpp", "${example_platform_dir}/util/LedOnOff.cpp", @@ -291,7 +291,7 @@ mcxw71_k32w1_executable("lock_app") { "-T" + rebase_path(ldscript, root_build_dir), ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] } diff --git a/examples/lock-app/nxp/k32w1/args.gni b/examples/lock-app/nxp/k32w1/args.gni index b7a2d790ef..bf46484106 100644 --- a/examples/lock-app/nxp/k32w1/args.gni +++ b/examples/lock-app/nxp/k32w1/args.gni @@ -37,8 +37,8 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = false -chip_with_ot_cli = 0 -chip_enable_matter_cli = true +nxp_enable_ot_cli = false +nxp_enable_matter_cli = true chip_with_diag_logs_demo = true -chip_with_low_power = 0 +nxp_use_low_power = false diff --git a/examples/lock-app/nxp/mcxw71/BUILD.gn b/examples/lock-app/nxp/mcxw71/BUILD.gn index 0c34d3d808..57328e2da8 100644 --- a/examples/lock-app/nxp/mcxw71/BUILD.gn +++ b/examples/lock-app/nxp/mcxw71/BUILD.gn @@ -85,7 +85,7 @@ mcxw71_k32w1_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", ] - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { include_dirs += [ "${example_platform_dir}/board" ] sources += [ "${example_platform_dir}/board/peripherals.c", @@ -124,7 +124,7 @@ mcxw71_k32w1_executable("lock_app") { defines += [ "CONFIG_DIAG_LOGS_DEMO=1" ] } - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { defines += [ "CONFIG_LOW_POWER=1" ] } else { defines += [ @@ -168,17 +168,17 @@ mcxw71_k32w1_executable("lock_app") { "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", ] - if (chip_with_low_power == 1) { + if (nxp_use_low_power) { sources += [ "${common_example_dir}/low_power/source/LowPower.cpp" ] } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ] deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] } - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", @@ -248,7 +248,7 @@ mcxw71_k32w1_executable("lock_app") { "../common/main/main.cpp", ] - if (chip_with_low_power == 0) { + if (!nxp_use_low_power) { sources += [ "${common_example_dir}/ui_feedback/source/LedManager.cpp", "${example_platform_dir}/util/LedOnOff.cpp", @@ -291,7 +291,7 @@ mcxw71_k32w1_executable("lock_app") { "-T" + rebase_path(ldscript, root_build_dir), ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] } diff --git a/examples/lock-app/nxp/mcxw71/args.gni b/examples/lock-app/nxp/mcxw71/args.gni index 1a0940c96a..59a25dfb43 100644 --- a/examples/lock-app/nxp/mcxw71/args.gni +++ b/examples/lock-app/nxp/mcxw71/args.gni @@ -37,8 +37,8 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = false -chip_with_ot_cli = 0 -chip_enable_matter_cli = true +nxp_enable_ot_cli = false +nxp_enable_matter_cli = true chip_with_diag_logs_demo = true -chip_with_low_power = 0 +nxp_use_low_power = false diff --git a/examples/lock-app/qpg/args.gni b/examples/lock-app/qpg/args.gni index d5dcdfe217..562005806d 100644 --- a/examples/lock-app/qpg/args.gni +++ b/examples/lock-app/qpg/args.gni @@ -31,5 +31,5 @@ chip_stack_lock_tracking = "none" matter_device_vid = "0xFFF1" matter_device_pid = "0x8006" -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/lock-app/silabs/BUILD.gn b/examples/lock-app/silabs/BUILD.gn index a20a4ad66f..81640548c3 100644 --- a/examples/lock-app/silabs/BUILD.gn +++ b/examples/lock-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -38,7 +38,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/lock-app/silabs/README.md b/examples/lock-app/silabs/README.md index 7b4f7fdbdf..0688f1ce70 100644 --- a/examples/lock-app/silabs/README.md +++ b/examples/lock-app/silabs/README.md @@ -277,6 +277,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset diff --git a/examples/lock-app/silabs/build_for_wifi_args.gni b/examples/lock-app/silabs/build_for_wifi_args.gni index cbc84b30bb..bb6da0b535 100644 --- a/examples/lock-app/silabs/build_for_wifi_args.gni +++ b/examples/lock-app/silabs/build_for_wifi_args.gni @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/lock-app/silabs/data_model:silabs-lock" diff --git a/examples/lock-app/silabs/data_model/lock-app.matter b/examples/lock-app/silabs/data_model/lock-app.matter index 512435d998..8a7695c75d 100644 --- a/examples/lock-app/silabs/data_model/lock-app.matter +++ b/examples/lock-app/silabs/data_model/lock-app.matter @@ -3261,7 +3261,7 @@ endpoint 1 { callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 0x7DB3; + ram attribute featureMap default = 0x1DB3; ram attribute clusterRevision default = 7; handle command LockDoor; diff --git a/examples/lock-app/silabs/data_model/lock-app.zap b/examples/lock-app/silabs/data_model/lock-app.zap index a10a27ee9a..e3488a663b 100644 --- a/examples/lock-app/silabs/data_model/lock-app.zap +++ b/examples/lock-app/silabs/data_model/lock-app.zap @@ -6188,7 +6188,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x7DB3", + "defaultValue": "0x1DB3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/lock-app/silabs/include/LockManager.h b/examples/lock-app/silabs/include/LockManager.h index 7345782d69..00a4407c34 100644 --- a/examples/lock-app/silabs/include/LockManager.h +++ b/examples/lock-app/silabs/include/LockManager.h @@ -199,10 +199,12 @@ class LockManager private: struct UnlatchContext { + static constexpr uint8_t kMaxPinLength = UINT8_MAX; + uint8_t mPinBuffer[kMaxPinLength]; + uint8_t mPinLength; chip::EndpointId mEndpointId; Nullable mFabricIdx; Nullable mNodeId; - Optional mPin; OperationErrorEnum mErr; void Update(chip::EndpointId endpointId, const Nullable & fabricIdx, @@ -211,8 +213,18 @@ class LockManager mEndpointId = endpointId; mFabricIdx = fabricIdx; mNodeId = nodeId; - mPin = pin; mErr = err; + + if (pin.HasValue()) + { + memcpy(mPinBuffer, pin.Value().data(), pin.Value().size()); + mPinLength = static_cast(pin.Value().size()); + } + else + { + memset(mPinBuffer, 0, kMaxPinLength); + mPinLength = 0; + } } }; UnlatchContext mUnlatchContext; @@ -242,11 +254,7 @@ class LockManager uint8_t mCredentialData[kNumCredentialTypes][kMaxCredentials][kMaxCredentialSize]; CredentialStruct mCredentials[kMaxUsers][kMaxCredentials]; - static LockManager sLock; EFR32DoorLock::LockInitParams::LockParam LockParams; }; -inline LockManager & LockMgr() -{ - return LockManager::sLock; -} +LockManager & LockMgr(); diff --git a/examples/lock-app/silabs/src/LockManager.cpp b/examples/lock-app/silabs/src/LockManager.cpp index 04527e53ac..6f5aba9147 100644 --- a/examples/lock-app/silabs/src/LockManager.cpp +++ b/examples/lock-app/silabs/src/LockManager.cpp @@ -25,11 +25,18 @@ #include #include -LockManager LockManager::sLock; - using namespace ::chip::DeviceLayer::Internal; using namespace EFR32DoorLock::LockInitParams; +namespace { +LockManager sLock; +} // namespace + +LockManager & LockMgr() +{ + return sLock; +} + CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable state, LockParam lockParam) { @@ -257,8 +264,11 @@ void LockManager::UnlockAfterUnlatch() bool succes = false; if (mUnlatchContext.mEndpointId != kInvalidEndpointId) { + Optional pin = (mUnlatchContext.mPinLength) + ? MakeOptional(chip::ByteSpan(mUnlatchContext.mPinBuffer, mUnlatchContext.mPinLength)) + : Optional::Missing(); succes = setLockState(mUnlatchContext.mEndpointId, mUnlatchContext.mFabricIdx, mUnlatchContext.mNodeId, - DlLockState::kUnlocked, mUnlatchContext.mPin, mUnlatchContext.mErr); + DlLockState::kUnlocked, pin, mUnlatchContext.mErr); } if (!succes) diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index 1af661767d..e748f41dc9 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:90 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:90 - Setup build environment: diff --git a/examples/ota-requestor-app/genio/args.gni b/examples/ota-requestor-app/genio/args.gni index 7a6cc1c74c..89889de70b 100644 --- a/examples/ota-requestor-app/genio/args.gni +++ b/examples/ota-requestor-app/genio/args.gni @@ -18,8 +18,8 @@ import("${chip_root}/src/platform/mt793x/args.gni") mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" chip_enable_ble = true diff --git a/examples/ota-requestor-app/genio/build_for_wifi_args.gni b/examples/ota-requestor-app/genio/build_for_wifi_args.gni index cb0ea7600a..3001e6648f 100644 --- a/examples/ota-requestor-app/genio/build_for_wifi_args.gni +++ b/examples/ota-requestor-app/genio/build_for_wifi_args.gni @@ -18,5 +18,5 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_openthread = false import("${chip_root}/src/platform/MT793X/wifi_args.gni") -pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index 647809108e..136a37a14c 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:90 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:90 - Setup build environment: diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 37dd7f4fe4..8740f39cdb 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -40,18 +40,6 @@ #include #endif -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#if CONFIG_BT_ENABLED -#include "esp_bt.h" -#if CONFIG_BT_NIMBLE_ENABLED -#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) -#include "esp_nimble_hci.h" -#endif // ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) -#include "nimble/nimble_port.h" -#endif // CONFIG_BT_NIMBLE_ENABLED -#endif // CONFIG_BT_ENABLED -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - #ifdef CONFIG_ENABLE_CHIP_SHELL #include #endif diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index a2e341efbe..e3b68e319e 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -96,6 +96,9 @@ #if CHIP_DEVICE_CONFIG_ENABLE_DEVICE_ENERGY_MANAGEMENT_TRIGGER #include #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#include +#endif #include #include @@ -298,6 +301,19 @@ void EventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) } } +void StopMainEventLoop() +{ + if (gMainLoopImplementation != nullptr) + { + gMainLoopImplementation->SignalSafeStopMainLoop(); + } + else + { + Server::GetInstance().GenerateShutDownEvent(); + PlatformMgr().ScheduleWork([](intptr_t) { PlatformMgr().StopEventLoopTask(); }); + } +} + void Cleanup() { #if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED @@ -314,17 +330,9 @@ void Cleanup() // We should stop using signals for those faults, and move to a different notification // means, like a pipe. (see issue #19114) #if !defined(ENABLE_CHIP_SHELL) -void StopSignalHandler(int signal) +void StopSignalHandler(int /* signal */) { - if (gMainLoopImplementation != nullptr) - { - gMainLoopImplementation->SignalSafeStopMainLoop(); - } - else - { - Server::GetInstance().GenerateShutDownEvent(); - PlatformMgr().ScheduleWork([](intptr_t) { PlatformMgr().StopEventLoopTask(); }); - } + StopMainEventLoop(); } #endif // !defined(ENABLE_CHIP_SHELL) @@ -527,7 +535,10 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) #if defined(ENABLE_CHIP_SHELL) Engine::Root().Init(); - std::thread shellThread([]() { Engine::Root().RunMainLoop(); }); + std::thread shellThread([]() { + Engine::Root().RunMainLoop(); + StopMainEventLoop(); + }); Shell::RegisterCommissioneeCommands(); #endif initParams.operationalServicePort = CHIP_PORT; @@ -593,6 +604,9 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) static DeviceEnergyManagementTestEventTriggerHandler sDeviceEnergyManagementTestEventTriggerHandler; sTestEventTriggerDelegate.AddHandler(&sDeviceEnergyManagementTestEventTriggerHandler); #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER + sTestEventTriggerDelegate.AddHandler(&Server::GetInstance().GetICDManager()); +#endif initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; @@ -686,14 +700,15 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) Server::GetInstance().Shutdown(); #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE + // Commissioner shutdown call shuts down entire stack, including the platform manager. ShutdownCommissioner(); +#else + DeviceLayer::PlatformMgr().Shutdown(); #endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE #if ENABLE_TRACING tracing_setup.StopTracing(); #endif - DeviceLayer::PlatformMgr().Shutdown(); - Cleanup(); } diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 336534aae6..30583ce7d0 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -15,6 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/app/common_flags.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/lib/lib.gni") import("${chip_root}/src/tracing/tracing_args.gni") @@ -133,6 +134,9 @@ source_set("app-main") { "${chip_root}/src/tracing", ] } + if (chip_enable_icd_server) { + deps += [ "${chip_root}/src/app/icd/server:manager" ] + } defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}", diff --git a/examples/platform/linux/Options.cpp b/examples/platform/linux/Options.cpp index 6f8afea5bb..30732ae7e0 100644 --- a/examples/platform/linux/Options.cpp +++ b/examples/platform/linux/Options.cpp @@ -46,6 +46,10 @@ #include #endif +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST +#include +#endif + using namespace chip; using namespace chip::ArgParser; using namespace chip::Platform; @@ -112,6 +116,9 @@ enum kDeviceOption_WiFiSupports5g, #if CONFIG_BUILD_FOR_HOST_UNIT_TEST kDeviceOption_SubscriptionResumptionRetryIntervalSec, + kDeviceOption_IdleRetransmitTimeout, + kDeviceOption_ActiveRetransmitTimeout, + kDeviceOption_ActiveThresholdTime, #endif #if CHIP_WITH_NLFAULTINJECTION kDeviceOption_FaultInjection, @@ -187,6 +194,9 @@ OptionDef sDeviceOptionDefs[] = { #if CONFIG_BUILD_FOR_HOST_UNIT_TEST { "subscription-capacity", kArgumentRequired, kDeviceOption_SubscriptionCapacity }, { "subscription-resumption-retry-interval", kArgumentRequired, kDeviceOption_SubscriptionResumptionRetryIntervalSec }, + { "idle-retransmit-timeout", kArgumentRequired, kDeviceOption_IdleRetransmitTimeout }, + { "active-retransmit-timeout", kArgumentRequired, kDeviceOption_ActiveRetransmitTimeout }, + { "active-threshold-time", kArgumentRequired, kDeviceOption_ActiveThresholdTime }, #endif #if CHIP_WITH_NLFAULTINJECTION { "faults", kArgumentRequired, kDeviceOption_FaultInjection }, @@ -335,6 +345,19 @@ const char * sDeviceOptionHelp = " Max number of subscriptions the device will allow\n" " --subscription-resumption-retry-interval\n" " subscription timeout resumption retry interval in seconds\n" + " --idle-retransmit-timeout \n" + " Sets the MRP idle retry interval (in milliseconds).\n" + " This interval is used by the peer to calculate the retransmission timeout when the current device is considered idle.\n" + "\n" + " --active-retransmit-timeout \n" + " Sets the MRP active retry interval (in milliseconds).\n" + " This interval is used by the peer to calculate the retransmission timeout when the current device is considered " + "active.\n" + "\n" + " --active-threshold-time Returns the review token for the request, which can be used to correlate with a FabricRestrictionReviewUpdate event. + + + @@ -145,6 +167,7 @@ limitations under the License. + @@ -154,6 +177,9 @@ limitations under the License. + + + @@ -162,6 +188,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/account-login-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/account-login-cluster.xml index baf74dc3c2..38fcbcaaf9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/account-login-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/account-login-cluster.xml @@ -28,31 +28,36 @@ limitations under the License. Upon receipt, the Content App checks if the account associated with the client Temp Account Identifier Rotating ID is the same acount that is active on the given Content App. If the accounts are the same, then the Content App includes the Setup PIN in the GetSetupPIN Response. - + + Upon receipt, the Content App checks if the account associated with the client’s Temp Account Identifier (Rotating ID) has a current active Setup PIN with the given value. If the Setup PIN is valid for the user account associated with the Temp Account Identifier, then the Content App MAY make that user account active. - + - + + The purpose of this command is to instruct the Content App to clear the current user account. This command SHOULD be used by clients of a Content App to indicate the end of a user session. + This message is sent in response to the GetSetupPIN Request, and contains the Setup PIN code, or null when the accounts identified in the request does not match the active account of the running Content App. + This event can be used by the Content App to indicate that the current user has logged out. In response to this event, the Fabric Admin SHALL remove access to this Content App by the specified Node. If no Node is provided, then the Fabric Admin SHALL remove access to all non-Admin Nodes. + diff --git a/src/app/zap-templates/zcl/data-model/chip/actions-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/actions-cluster.xml index acf28b88e4..73c38134ed 100644 --- a/src/app/zap-templates/zcl/data-model/chip/actions-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/actions-cluster.xml @@ -89,11 +89,17 @@ limitations under the License. 0x0025 ACTIONS_CLUSTER This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. - - ActionList - EndpointLists - SetupURL - + + + + + + + + + + + This command triggers an action (state change) on the involved endpoints. @@ -173,17 +179,19 @@ limitations under the License. This event SHALL be generated when there is a change in the Status of an ActionID. - - + + + This event SHALL be generated when there is some error which prevents the action from its normal planned execution. - - - - + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/administrator-commissioning-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/administrator-commissioning-cluster.xml index 3532c89b93..ba6b7fd266 100644 --- a/src/app/zap-templates/zcl/data-model/chip/administrator-commissioning-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/administrator-commissioning-cluster.xml @@ -43,10 +43,16 @@ limitations under the License. - WindowStatus - AdminFabricIndex - AdminVendorId - + + + + + + + + + + This command is used by a current Administrator to instruct a Node to go into commissioning mode using enhanced commissioning method. @@ -55,17 +61,22 @@ limitations under the License. + This command is used by a current Administrator to instruct a Node to go into commissioning mode using basic commissioning method, if the node supports it. + + + This command is used by a current Administrator to instruct a Node to revoke any active Open Commissioning Window or Open Basic Commissioning Window command. + diff --git a/src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml index bbc57510e8..1b5d34b7ba 100644 --- a/src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml @@ -41,7 +41,9 @@ limitations under the License. - AirQuality + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/application-basic-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/application-basic-cluster.xml index e6331f698f..704b8cadbe 100644 --- a/src/app/zap-templates/zcl/data-model/chip/application-basic-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/application-basic-cluster.xml @@ -24,16 +24,30 @@ limitations under the License. true true This cluster provides information about an application running on a TV or media player device which is represented as an endpoint. - VendorName - VendorID - ApplicationName - ProductID - Application - Status - ApplicationVersion - - AllowedVendorList - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/application-launcher-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/application-launcher-cluster.xml index 50b715e138..d69437a298 100644 --- a/src/app/zap-templates/zcl/data-model/chip/application-launcher-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/application-launcher-cluster.xml @@ -31,29 +31,39 @@ limitations under the License. - CatalogList - CurrentApp - + + + + + + + + + Upon receipt, this SHALL launch the specified app with optional data. The TV Device SHALL launch and bring to foreground the identified application in the command if the application is not already launched and in foreground. The TV Device SHALL update state attribute on the Application Basic cluster of the Endpoint corresponding to the launched application. This command returns a Launch Response. + Upon receipt on a Video Player endpoint this SHALL stop the specified application if it is running. + Upon receipt on a Video Player endpoint this SHALL hide the specified application if it is running and visible. + This command SHALL be generated in response to LaunchApp commands. + diff --git a/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml index acaa9deadb..d24b34f402 100644 --- a/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/audio-output-cluster.xml @@ -31,12 +31,17 @@ limitations under the License. - OutputList - CurrentOutput - + + + + + + + Upon receipt, this SHALL change the output on the media device to the output at a specific index in the Output List. + @@ -44,6 +49,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml index 3245020891..80119e8ec0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/ballast-configuration-cluster.xml @@ -41,53 +41,61 @@ limitations under the License. - PhysicalMinLevel - PhysicalMaxLevel - BallastStatus + + + + + + + + + - - MinLevel - + + + - - MaxLevel - + + + - - IntrinsicBallastFactor - + + + - - BallastFactorAdjustment - + + + - LampQuantity + + + - - LampType - + + + - - LampManufacturer - + + + - - LampRatedHours - + + + - - LampBurnHours - + + + - - LampAlarmMode - + + + - - LampBurnHoursTripPoint - + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml index 7f6320a588..f08d9dc2be 100644 --- a/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml @@ -74,52 +74,95 @@ limitations under the License. which apply to the whole Node. Also allows setting user device information such as location. - DataModelRevision - VendorName - VendorID - ProductName - ProductID - - NodeLabel + + + + + + + + + + + + + + + + + - - Location + + + + + + + + + + + + + + + + + - HardwareVersion - HardwareVersionString - SoftwareVersion - SoftwareVersionString - ManufacturingDate - PartNumber - ProductURL - ProductLabel - SerialNumber - - LocalConfigDisabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Reachable - UniqueID - CapabilityMinima - ProductAppearance - SpecificationVersion - MaxPathsPerInvoke The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process. + The ShutDown event SHOULD be emitted by a Node prior to any orderly shutdown sequence on a best-effort basis. + The Leave event SHOULD be emitted by a Node prior to permanently leaving the Fabric. + This event (when supported) SHALL be generated when there is a change in the Reachable attribute. diff --git a/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml index 741a5a9372..19f2b0933c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/binding-cluster.xml @@ -31,9 +31,9 @@ limitations under the License. 0x001e BINDING_CLUSTER The Binding Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for supporting the binding table. - - Binding - + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/boolean-state-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/boolean-state-cluster.xml index 0dee692aff..292067d12a 100644 --- a/src/app/zap-templates/zcl/data-model/chip/boolean-state-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/boolean-state-cluster.xml @@ -26,11 +26,14 @@ limitations under the License. true true - StateValue - + + + + This event SHALL be generated when the StateValue attribute changes. + diff --git a/src/app/zap-templates/zcl/data-model/chip/boolean-state-configuration-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/boolean-state-configuration-cluster.xml index 4fb33dd974..a301b4eacf 100644 --- a/src/app/zap-templates/zcl/data-model/chip/boolean-state-configuration-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/boolean-state-configuration-cluster.xml @@ -58,34 +58,89 @@ limitations under the License. - CurrentSensitivityLevel - SupportedSensitivityLevels - DefaultSensitivityLevel - AlarmsActive - AlarmsSuppressed - AlarmsEnabled - AlarmsSupported - SensorFault - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This command is used to suppress the specified alarm mode. + + + This command is used to enable or disable the specified alarm mode. + + + + + + This event SHALL be generated when any bits in the AlarmsActive and/or AlarmsSuppressed attributes change. + + + + + + This event SHALL be generated when the device registers or clears a fault. + diff --git a/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml index 5cbf1d28ec..24c66bcc7a 100644 --- a/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/camera-av-stream-management-cluster.xml @@ -18,10 +18,10 @@ limitations under the License. XML generated by Alchemy; DO NOT EDIT. Source: src/app_clusters/CameraAVStreamManagement.adoc Parameters: in-progress -Git: 0.9-fall2024-411-g9835b5cd7 +Git: 1.3-3824-g29c49ca54 --> - + @@ -144,173 +144,323 @@ Git: 0.9-fall2024-411-g9835b5cd7 - + Cameras Camera AV Stream Management 0x0551 CAMERA_AV_STREAM_MANAGEMENT_CLUSTER The Camera AV Stream Management cluster is used to allow clients to manage, control, and configure various audio, video, and snapshot streams on a camera. true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - MaxConcurrentVideoEncoders - MaxEncodedPixelRate - VideoSensorParams - NightVisionCapable - MinViewport - RateDistortionTradeOffPoints - MaxContentBufferSize - MicrophoneCapabilities - SpeakerCapabilities - TwoWayTalkSupport - SupportedSnapshotParams - MaxNetworkBandwidth - CurrentFrameRate + + MaxConcurrentVideoEncoders + + + + + + MaxEncodedPixelRate + + + + + + VideoSensorParams + + + + + + NightVisionCapable + + + + + + MinViewport + + + + + + RateDistortionTradeOffPoints + + + + + + MaxContentBufferSize + + + + + + MicrophoneCapabilities + + + + + + SpeakerCapabilities + + + + + + + + + TwoWayTalkSupport + + + + + + + + + SupportedSnapshotParams + + + + + MaxNetworkBandwidth + + CurrentFrameRate + + + + HDRModeEnabled + + + + + + CurrentVideoCodecs + + + + + + CurrentSnapshotConfig + + + - CurrentVideoCodecs - CurrentSnapshotConfig - FabricsUsingCamera - AllocatedVideoStreams - AllocatedAudioStreams - AllocatedSnapshotStreams - + FabricsUsingCamera + + AllocatedVideoStreams + + + + + + AllocatedAudioStreams + + + + + + AllocatedSnapshotStreams + + + + + RankedVideoStreamPrioritiesList + + + + + + SoftRecordingPrivacyModeEnabled + + + + + + SoftLivestreamPrivacyModeEnabled + + + + + + HardPrivacyModeOn + - SoftRecordingPrivacyModeEnabled - SoftLivestreamPrivacyModeEnabled - HardPrivacyModeOn NightVision + + + + + + NightVisionIllum + + + + + + - - AWBEnabled - - - - - AutoShutterSpeedEnabled - - - - - AutoISOEnabled + + Viewport + + + - Viewport - + SpeakerMuted + + + + + + - + SpeakerVolumeLevel + + + + + + - + SpeakerMaxLevel - + + + + + + - + SpeakerMinLevel - + + + + + + - + MicrophoneMuted + + + - + MicrophoneVolumeLevel + + + - + MicrophoneMaxLevel - + + + - + MicrophoneMinLevel - + + + - + MicrophoneAGCEnabled + + + + + + ImageRotation + + + + + + + + ImageFlipHorizontal + + + + + + + + ImageFlipVertical + + + + + - ImageRotation - ImageFlipHorizontal - ImageFlipVertical - + LocalVideoRecordingEnabled + + + + + + - + LocalSnapshotRecordingEnabled + + + + + + - + StatusLightEnabled + - + StatusLightBrightness - - - DepthSensorStatus - - + This command SHALL allocate an audio stream on the camera and return an allocated audio stream identifier. @@ -321,17 +471,26 @@ Git: 0.9-fall2024-411-g9835b5cd7 + + + This command SHALL be sent by the camera in response to the AudioStreamAllocate command, carrying the newly allocated audio stream identifier. + + + This command SHALL deallocate an audio stream on the camera, corresponding to the given audio stream identifier. + + + @@ -349,11 +508,17 @@ Git: 0.9-fall2024-411-g9835b5cd7 + + + This command SHALL be sent by the camera in response to the VideoStreamAllocate command, carrying the newly allocated video stream identifier. + + + @@ -363,12 +528,18 @@ Git: 0.9-fall2024-411-g9835b5cd7 + + + This command SHALL deallocate a video stream on the camera, corresponding to the given video stream identifier. + + + @@ -380,17 +551,26 @@ Git: 0.9-fall2024-411-g9835b5cd7 + + + This command SHALL be sent by the device in response to the SnapshotStreamAllocate command, carrying the newly allocated snapshot stream identifier. + + + This command SHALL deallocate an snapshot stream on the camera, corresponding to the given snapshot stream identifier. + + + @@ -401,40 +581,23 @@ Git: 0.9-fall2024-411-g9835b5cd7 This command SHALL return a Snapshot from the camera. - + + + + This command SHALL be sent by the device in response to the CaptureSnapshot command, carrying the requested snapshot. + - - - - This command sets the viewport in all video streams. - - - - - - The data fields for this command SHALL be as follows: - - - - - - The data fields for this command SHALL be as follows: - - - - - - The data fields for this command SHALL be as follows: - - + + + @@ -450,6 +613,9 @@ Git: 0.9-fall2024-411-g9835b5cd7 This event SHALL be generated when there is a modification in the corresponding video stream. + + + @@ -461,6 +627,9 @@ Git: 0.9-fall2024-411-g9835b5cd7 This event SHALL be generated when there is a modification in the corresponding audio stream. + + + @@ -472,7 +641,39 @@ Git: 0.9-fall2024-411-g9835b5cd7 This event SHALL be generated when there is a modification in the corresponding snapshot stream. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml index 25ec7b7062..cb4bcd9adb 100644 --- a/src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml @@ -41,30 +41,54 @@ limitations under the License. - ChannelList - Lineup - CurrentChannel - + + + + + + + + + + + + + + Change the channel on the media player to the channel case-insensitive exact matching the value passed as an argument. + + + + + + Change the channel on the media plaeyer to the channel with the given Number in the ChannelList attribute. + This command provides channel up and channel down functionality, but allows channel index jumps of size Count. When the value of the increase or decrease is larger than the number of channels remaining in the given direction, then the behavior SHALL be to return to the beginning (or end) of the channel list and continue. For example, if the current channel is at index 0 and count value of -1 is given, then the current channel should change to the last channel. + Upon receipt, this SHALL display the active status of the input list on screen. + + + + + + @@ -76,12 +100,18 @@ limitations under the License. + + + This command is a response to the GetProgramGuide command. + + + @@ -90,6 +120,12 @@ limitations under the License. + + + + + + @@ -98,6 +134,12 @@ limitations under the License. + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml b/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml index 04fa274363..14767f6429 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml @@ -121,8 +121,7 @@ limitations under the License. OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER true true - - DefaultOTAProviders + diff --git a/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml index 3623ce1ccf..b3be97a217 100644 --- a/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml @@ -127,135 +127,359 @@ limitations under the License. - CurrentHue + + + + + - CurrentSaturation + + + + + - RemainingTime + + + - CurrentX + + + + + - CurrentY + + + + + - DriftCompensation + + + - CompensationText + + + - ColorTemperatureMireds + + + + + - ColorMode + + + - Options + + + - NumberOfPrimaries + + + - Primary1X + + + + + + + + + + + - Primary1Y + + + + + + + + + + + - Primary1Intensity + + + + + + + + + + + - Primary2X + + + + + + + + + + + - Primary2Y + + + + + + + + + + + - Primary2Intensity + + + + + + + + + + + - Primary3X + + + + + + + + + + + - Primary3Y + + + + + + + + + + + - Primary3Intensity + + + + + + + + + + + - Primary4X + + + + + + + + + + + - Primary4Y + + + + + + + + + + + - Primary4Intensity + + + + + + + + + + + - Primary5X + + + + + + + + + + + - Primary5Y + + + + + + + + + + + - Primary5Intensity + + + + + + + + + + + - Primary6X + + + + + + + + + + + - Primary6Y + + + + + + + + + + + - Primary6Intensity + + + + + + + + + + + - - WhitePointX + + - - WhitePointY + + - - ColorPointRX + + - - ColorPointRY + + - - ColorPointRIntensity + + - - ColorPointGX + + - - ColorPointGY + + - - ColorPointGIntensity + + - - ColorPointBX + + - - ColorPointBY + + - - ColorPointBIntensity + + - CoupleColorTempToLevelMinMireds - - StartUpColorTemperatureMireds + + + + + + + + + + + + + + + @@ -267,6 +491,9 @@ limitations under the License. + + + @@ -277,6 +504,9 @@ limitations under the License. + + + @@ -288,6 +518,9 @@ limitations under the License. + + + @@ -298,6 +531,9 @@ limitations under the License. + + + @@ -308,6 +544,9 @@ limitations under the License. + + + @@ -319,6 +558,9 @@ limitations under the License. + + + @@ -330,6 +572,9 @@ limitations under the License. + + + @@ -341,6 +586,9 @@ limitations under the License. + + + @@ -351,6 +599,9 @@ limitations under the License. + + + @@ -362,6 +613,9 @@ limitations under the License. + + + @@ -372,20 +626,59 @@ limitations under the License. + + + - EnhancedCurrentHue - EnhancedColorMode - ColorLoopActive - ColorLoopDirection - ColorLoopTime - ColorLoopStartEnhancedHue - ColorLoopStoredEnhancedHue - ColorCapabilities - ColorTempPhysicalMinMireds - ColorTempPhysicalMaxMireds + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -396,6 +689,9 @@ limitations under the License. + + + @@ -406,6 +702,9 @@ limitations under the License. + + + @@ -417,6 +716,9 @@ limitations under the License. + + + @@ -428,6 +730,9 @@ limitations under the License. + + + @@ -441,6 +746,9 @@ limitations under the License. + + + @@ -449,6 +757,13 @@ limitations under the License. + + + + + + + @@ -461,6 +776,9 @@ limitations under the License. + + + @@ -474,6 +792,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml index dcfb1dfa70..1422733cc0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml @@ -32,9 +32,9 @@ limitations under the License. - - SupportedDeviceCategories + + @@ -44,6 +44,7 @@ limitations under the License. + @@ -51,6 +52,7 @@ limitations under the License. + @@ -60,6 +62,7 @@ limitations under the License. + @@ -68,6 +71,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml index 4d03c53910..27b298ae25 100644 --- a/src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml @@ -58,17 +58,59 @@ limitations under the License. - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -113,17 +155,59 @@ limitations under the License. - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -139,45 +223,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -193,45 +319,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -247,45 +415,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -301,45 +511,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -355,45 +607,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -409,45 +703,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -463,45 +799,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -517,45 +895,87 @@ limitations under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - PeakMeasuredValue - PeakMeasuredValueWindow - AverageMeasuredValue - AverageMeasuredValueWindow - Uncertainty - MeasurementUnit - MeasurementMedium - LevelValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml index 6e241c7b5c..0f5a99b6ba 100644 --- a/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml @@ -29,6 +29,7 @@ limitations under the License. Upon receipt, the data field MAY be parsed and interpreted. Message encoding is specific to the Content App. A Content App MAY when possible read attributes from the Basic Information Cluster on the Observer and use this to determine the Message encoding. + @@ -36,6 +37,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml index 06468c114c..d628663fcc 100644 --- a/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml @@ -43,69 +43,131 @@ limitations under the License. - Enabled - OnDemandRatings - OnDemandRatingThreshold - ScheduledContentRatings - ScheduledContentRatingThreshold - ScreenDailyTime - RemainingScreenTime - BlockUnrated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The purpose of this command is to update the PIN used for protecting configuration of the content control settings. Upon success, the old PIN SHALL no longer work. The PIN is used to ensure that only the Node (or User) with the PIN code can make changes to the Content Control settings, for example, turn off Content Controls or modify the ScreenDailyTime. The PIN is composed of a numeric string of up to 6 human readable characters (displayable) . Upon receipt of this command, the media device SHALL check if the OldPIN field of this command is the same as the current PIN. If the PINs are the same, then the PIN code SHALL be set to NewPIN. Otherwise a response with InvalidPINCode error status SHALL be returned. The media device MAY provide a default PIN to the User via an out of band mechanism. For security reasons, it is recommended that a client encourage the user to update the PIN from its default value when performing configuration of the Content Control settings exposed by this cluster. The ResetPIN command can also be used to obtain the default PIN. + + + The purpose of this command is to reset the PIN. If this command is executed successfully, a ResetPINResponse command with a new PIN SHALL be returned. + + + This command SHALL be generated in response to a ResetPIN command. The data for this command SHALL be as follows: + + + The purpose of this command is to turn on the Content Control feature on a media device. On receipt of the Enable command, the media device SHALL set the Enabled attribute to TRUE. + The purpose of this command is to turn off the Content Control feature on a media device. On receipt of the Disable command, the media device SHALL set the Enabled attribute to FALSE. + The purpose of this command is to add the extra screen time for the user. If a client with Operate privilege invokes this command, the media device SHALL check whether the PINCode passed in the command matches the current PINCode value. If these match, then the RemainingScreenTime attribute SHALL be increased by the specified BonusTime value. If the PINs do not match, then a response with InvalidPINCode error status SHALL be returned, and no changes SHALL be made to RemainingScreenTime. If a client with Manage privilege or greater invokes this command, the media device SHALL ignore the PINCode field and directly increase the RemainingScreenTime attribute by the specified BonusTime value. A server that does not support the PM feature SHALL respond with InvalidPINCode to clients that only have Operate privilege unless: It has been provided with the PIN value to expect via an out of band mechanism, and The client has provided a PINCode that matches the expected PIN value. + + + The purpose of this command is to set the ScreenDailyTime attribute. On receipt of the SetScreenDailyTime command, the media device SHALL set the ScreenDailyTime attribute to the ScreenTime value. + + + The purpose of this command is to specify whether programs with no Content rating must be blocked by this media device. On receipt of the BlockUnratedContent command, the media device SHALL set the BlockUnrated attribute to TRUE. + + + The purpose of this command is to specify whether programs with no Content rating must be blocked by this media device. On receipt of the UnblockUnratedContent command, the media device SHALL set the BlockUnrated attribute to FALSE. + + + The purpose of this command is to set the OnDemandRatingThreshold attribute. On receipt of the SetOnDemandRatingThreshold command, the media device SHALL check if the Rating field is one of values present in the OnDemandRatings attribute. If not, then a response with InvalidRating error status SHALL be returned. + + + The purpose of this command is to set ScheduledContentRatingThreshold attribute. On receipt of the SetScheduledContentRatingThreshold command, the media device SHALL check if the Rating field is one of values present in the ScheduledContentRatings attribute. If not, then a response with InvalidRating error status SHALL be returned. + + + This event SHALL be generated when the RemainingScreenTime equals 0. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml index 7058f96979..4d96173013 100644 --- a/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml @@ -25,10 +25,18 @@ limitations under the License. true This cluster provides an interface for launching content on a media player device such as a TV or Speaker. - - AcceptHeader - SupportedStreamingProtocols - + + + + + + + + + + + + Upon receipt, this SHALL launch the specified content with optional search criteria. @@ -36,6 +44,9 @@ limitations under the License. + + + @@ -43,12 +54,21 @@ limitations under the License. + + + This command SHALL be generated in response to LaunchContent command. + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/descriptor-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/descriptor-cluster.xml index d63dbeb05c..b7495d2d84 100644 --- a/src/app/zap-templates/zcl/data-model/chip/descriptor-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/descriptor-cluster.xml @@ -44,11 +44,23 @@ limitations under the License. - - DeviceTypeList - ServerList - ClientList - PartsList - TagList + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml index 3550dd0301..2d551a2d42 100644 --- a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml @@ -74,41 +74,87 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 - ESAType - ESACanGenerate - ESAState - AbsMinPower - AbsMaxPower + + + + + + + + + + + + + + + - PowerAdjustmentCapability + + + + + - Forecast - OptOutState + + + + + + + + + + + + + + + + + + + Allows a client to request an adjustment in the power consumption of an ESA for a specified duration. + + + Allows a client to cancel an ongoing PowerAdjustmentRequest operation. + + + Allows a client to adjust the start time of a Forecast sequence that has not yet started operation (i.e. where the current Forecast StartTime is in the future). + + + Allows a client to temporarily pause an operation and reduce the ESAs energy demand. + + + Allows a client to cancel the PauseRequest command and enable earlier resumption of operation. + + + @@ -116,20 +162,36 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 + + + Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. + + + Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command. + + + + + + + This event SHALL be generated when the Power Adjustment session is started. + + + @@ -137,15 +199,24 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 + + + This event SHALL be generated when the ESA enters the Paused state. + + + This event SHALL be generated when the ESA leaves the Paused state and resumes operation. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml index c3440adebe..bad3b92e06 100644 --- a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml @@ -59,18 +59,24 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 - SupportedModes - CurrentMode + + + + + + This command is used to change device modes. + This command is sent by the device on receipt of the ChangeToMode command. + diff --git a/src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml index 27162f66e5..4140fd18a0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml @@ -15,46 +15,48 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - - - - - - - - - - - - - - - - - Diagnostic Logs - CHIP - The cluster provides commands for retrieving unstructured diagnostic logs from a Node that may be used to aid in diagnostics. - 0x0032 - DIAGNOSTIC_LOGS_CLUSTER - true - true - - Retrieving diagnostic logs from a Node - - - - - - Response to the RetrieveLogsRequest - - - - - - + + + + + + + + + + + + + + + + + + + + + + Diagnostic Logs + CHIP + The cluster provides commands for retrieving unstructured diagnostic logs from a Node that may be used to aid in diagnostics. + 0x0032 + DIAGNOSTIC_LOGS_CLUSTER + true + true + + Retrieving diagnostic logs from a Node + + + + + + + Response to the RetrieveLogsRequest + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml index 7e41a7a1c0..f460f42a19 100644 --- a/src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml @@ -43,27 +43,42 @@ limitations under the License. - Mask - Latch - State - Supported + + + + + + + + + + + + + + - Reset alarm - + Reset alarm + + + + - Modify enabled alarms - + Modify enabled alarms + + - Notify - - - - + Notify + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml index 7c7dec635f..49403ab547 100644 --- a/src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml @@ -57,11 +57,15 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + StartUpMode OnMode - + @@ -69,6 +73,7 @@ limitations under the License. On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + @@ -77,6 +82,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml index b25cd549d9..03042ad346 100644 --- a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml @@ -131,659 +131,856 @@ limitations under the License. 3. Everything that depends on a certain feature is optional because we have no way of setting up the dependencies here. Dependencies would be probably resolved in the cluster itself. Those attributes/commands are marked with a special comment. --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This command causes the lock device to lock the door. + + + + + + This command causes the lock device to unlock the door. + + + + + + + This command causes the lock device to unlock the door with a timeout parameter. + + + + + + + + Set a weekly repeating schedule for a specified user. + + + + + + + + + + + + + + + Retrieve the specific weekly schedule for the specific user. + + + + + + + + + + Returns the weekly repeating schedule data for the specified schedule index. + + + + + + + + + + + + + + + Clear the specific weekly schedule or all weekly schedules for the specific user. + + + + + + + + + + Set a time-specific schedule ID for a specified user. + + + + + + + + + + + + Returns the year day schedule data for the specified schedule and user indexes. + + + + + + + + + + Returns the year day schedule data for the specified schedule and user indexes. + + + + + + + + + + + + Clears the specific year day schedule or all year day schedules for the specific user. + + + + + + + + + + Set the holiday Schedule by specifying local start time and local end time with respect to any Lock Operating Mode. + + + + + + + + + + + + Get the holiday schedule for the specified index. + + + + + + + + + Returns the Holiday Schedule Entry for the specified Holiday ID. + + + + + + + + + + + + Clears the holiday schedule or all holiday schedules. + + + + + + + + + Set User into the lock. + + + + + + + + + + + + + + + Retrieve User. + + + + + + + + + Returns the User for the specified UserIndex. + + + + + + + + + + + + + + + + + Clears a User or all Users. + + + + + + + + + Set a credential (e.g. PIN, RFID, Fingerprint, etc.) into the lock for a new user, existing user, or ProgrammingUser. + + + + + + + + + + + + + + Returns the status for setting the specified credential. + + + + + + + + + + Retrieve the status of a particular credential (e.g. PIN, RFID, Fingerprint, etc.) by index. + + + + + + + + + Returns the status for the specified credential. + + + + + + + + + + + + + Clear one, one type, or all credentials except ProgrammingPIN credential. + + + + + + + + This command causes the lock device to unlock the door without pulling the latch. + + + + + + + + This command communicates an Aliro Reader configuration to the lock. + + + + + + + + + + + This command clears an existing Aliro Reader configuration for the lock. + + + + + - - LockState - LockType - ActuatorEnabled - - DoorState - - - DoorOpenEvents - - - - - - DoorClosedEvents - - - - - - OpenPeriod - - - - - NumberOfTotalUsersSupported - - NumberOfPINUsersSupported - - NumberOfRFIDUsersSupported - - NumberOfWeekDaySchedulesSupportedPerUser - - NumberOfYearDaySchedulesSupportedPerUser - - NumberOfHolidaySchedulesSupported - - MaxPINCodeLength - - MinPINCodeLength - - MaxRFIDCodeLength - - MinRFIDCodeLength - - CredentialRulesSupport - - NumberOfCredentialsSupportedPerUser - - Language - - - - - LEDSettings - - - - - AutoRelockTime - - - - - SoundVolume - - - - - OperatingMode - - - - SupportedOperatingModes - DefaultConfigurationRegister - - EnableLocalProgramming - - - - - EnableOneTouchLocking - - - - - EnableInsideStatusLED - - - - - EnablePrivacyModeButton - - - - - LocalProgrammingFeatures - - - - - - WrongCodeEntryLimit - - - - - - UserCodeTemporaryDisableTime - - - - - - SendPINOverTheAir - - - - - - RequirePINforRemoteOperation - - - - - - - ExpiringUserTimeout - - - - - - AliroReaderVerificationKey - - - - - AliroReaderGroupIdentifier - - - - - AliroReaderGroupSubIdentifier - - - - - AliroExpeditedTransactionSupportedProtocolVersions - - - - - AliroGroupResolvingKey - - - - - AliroSupportedBLEUWBProtocolVersions - - - - - AliroBLEAdvertisingVersion - - - - NumberOfAliroCredentialIssuerKeysSupported - - NumberOfAliroEndpointKeysSupported - - - - This command causes the lock device to lock the door. - - - - - This command causes the lock device to unlock the door. - - - - - - This command causes the lock device to unlock the door with a timeout parameter. - - - - - - - Set a weekly repeating schedule for a specified user. - - - - - - - - - - - - Retrieve the specific weekly schedule for the specific user. - - - - - - - Returns the weekly repeating schedule data for the specified schedule index. - - - - - - - - - - - - Clear the specific weekly schedule or all weekly schedules for the specific user. - - - - - - - Set a time-specific schedule ID for a specified user. - - - - - - - - - Returns the year day schedule data for the specified schedule and user indexes. - - - - - - - Returns the year day schedule data for the specified schedule and user indexes. - - - - - - - - - Clears the specific year day schedule or all year day schedules for the specific user. - - - - - - - Set the holiday Schedule by specifying local start time and local end time with respect to any Lock Operating Mode. - - - - - - - - - Get the holiday schedule for the specified index. - - - - - - Returns the Holiday Schedule Entry for the specified Holiday ID. - - - - - - - - - Clears the holiday schedule or all holiday schedules. - - - - - - Set User into the lock. - - - - - - - - - - - - Retrieve User. - - - - - - Returns the User for the specified UserIndex. - - - - - - - - - - - - - - Clears a User or all Users. - - - - - - Set a credential (e.g. PIN, RFID, Fingerprint, etc.) into the lock for a new user, existing user, or ProgrammingUser. - - - - - - - - - - - Returns the status for setting the specified credential. - - - - - - - Retrieve the status of a particular credential (e.g. PIN, RFID, Fingerprint, etc.) by index. - - - - - - Returns the status for the specified credential. - - - - - - - - - - Clear one, one type, or all credentials except ProgrammingPIN credential. - - - - - This command causes the lock device to unlock the door without pulling the latch. - - - - - This command communicates an Aliro Reader configuration to the lock. - - - - - - - - This command clears an existing Aliro Reader configuration for the lock. - - - - - - - The door lock cluster provides several alarms which can be sent when there is a critical state on the door lock. - - - - - The door lock server sends out a DoorStateChange event when the door lock door state changes. - - - - The door lock server sends out a LockOperation event when the event is triggered by the various lock operation sources. - - - - - - - - - - The door lock server sends out a LockOperationError event when a lock operation fails for various reasons. - - - - - - - - - - - The door lock server sends out a LockUserChange event when a lock user, schedule, or credential change has occurred. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + The door lock cluster provides several alarms which can be sent when there is a critical state on the door lock. + + + + + + The door lock server sends out a DoorStateChange event when the door lock door state changes. + + + + + + + The door lock server sends out a LockOperation event when the event is triggered by the various lock operation sources. + + + + + + + + + + + The door lock server sends out a LockOperationError event when a lock operation fails for various reasons. + + + + + + + + + + + + The door lock server sends out a LockUserChange event when a lock user, schedule, or credential change has occurred. + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - + + + + + - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -796,7 +993,7 @@ limitations under the License. - + @@ -808,7 +1005,7 @@ limitations under the License. - + @@ -824,7 +1021,7 @@ limitations under the License. - + @@ -836,7 +1033,7 @@ limitations under the License. - + @@ -846,7 +1043,7 @@ limitations under the License. - + @@ -858,7 +1055,7 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml index d64bce1c85..752a917fd3 100644 --- a/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml @@ -199,21 +199,33 @@ limitations under the License. - LoadControlPrograms - NumberOfLoadControlPrograms - Events - ActiveEvents - NumberOfEventsPerProgram - NumberOfTransitions - - DefaultRandomStart + + + + + + + + + + + + + + + + + + + + - - DefaultRandomDuration + + @@ -221,18 +233,21 @@ limitations under the License. Upon receipt, this SHALL insert a new LoadControlProgramStruct into LoadControlPrograms, or if the ProgramID matches an existing LoadControlProgramStruct, then the provider SHALL be updated with the provided values. + Upon receipt, this SHALL remove a the LoadControlProgramStruct from LoadControlPrograms with the matching ProgramID. + On receipt of the AddLoadControlEventsRequest command, the server SHALL add a load control event. + @@ -240,6 +255,7 @@ limitations under the License. + + diff --git a/src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml index 73ae522365..06f931ef07 100644 --- a/src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml @@ -44,12 +44,10 @@ limitations under the License. true - - DeviceDirectory + - - LocationDirectory + diff --git a/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml index eb05052538..c8501c412c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml @@ -42,25 +42,65 @@ limitations under the License. - Accuracy - CumulativeEnergyImported + + + + + + + + + + + - CumulativeEnergyExported + + + + + + + + - PeriodicEnergyImported + + + + + + + + - PeriodicEnergyExported - CumulativeEnergyReset + + + + + + + + + + + + + CumulativeEnergyMeasured + + + PeriodicEnergyMeasured + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml index 7f49a643d1..0a4fccb6b9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml @@ -51,40 +51,105 @@ limitations under the License. - PowerMode - NumberOfMeasurementTypes - Accuracy - Ranges - Voltage + + + + + + + + + + + + + + + - ActiveCurrent + + + - ReactiveCurrent - ApparentCurrent + + + + + + + + + + - ActivePower + + + - ReactivePower + + + + + - ApparentPower + + + + + - RMSVoltage + + + + + - RMSCurrent + + + + + - RMSPower + + + + + - Frequency + + + + + - HarmonicCurrents + + + + + - HarmonicPhases + + + + + - PowerFactor - NeutralCurrent + + + + + + + + + + MeasurementPeriodRanges + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 7a4a40d2e3..8c26a92587 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -128,53 +128,119 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 - State - SupplyState - FaultState - ChargingEnabledUntil + + + + + + + + + + + + - DischargingEnabledUntil - CircuitCapacity - MinimumChargeCurrent - MaximumChargeCurrent + + + + + + + + + + + + + + - MaximumDischargeCurrent + + + + + UserMaximumChargeCurrent + RandomizationDelayWindow + - NextChargeStartTime + + + + + - NextChargeTargetTime + + + + + - NextChargeRequiredEnergy + + + + + - NextChargeTargetSoC + + + + + ApproximateEVEfficiency + + + - StateOfCharge + + + + + - BatteryCapacity + + + + + - VehicleID - SessionID - SessionDuration - SessionEnergyCharged + + + + + + + + + + + + + + - SessionEnergyDischarged + + + + + Allows a client to disable the EVSE from charging and discharging. + @@ -182,39 +248,57 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 This command allows a client to enable the EVSE to charge an EV, and to provide or update the maximum and minimum charge current. + Upon receipt, this SHALL allow a client to enable the discharge of an EV, and to provide or update the maximum discharge current. + + + Allows a client to put the EVSE into a self-diagnostics mode. + Allows a client to set the user specified charging targets. + + + Allows a client to retrieve the current set of charging targets. + + + Allows a client to clear all stored charging targets. + + + The GetTargetsResponse is sent in response to the GetTargets Command. + + + This event SHALL be generated when the EV is plugged in. + @@ -224,6 +308,7 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 + @@ -232,6 +317,7 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 + @@ -241,6 +327,7 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 + @@ -249,11 +336,15 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 + This event SHALL be generated when a RFID card has been read. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml index b28daf8899..52b066d7b8 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml @@ -59,18 +59,24 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 - SupportedModes - CurrentMode + + + + + + This command is used to change device modes. + This command is sent by the device on receipt of the ChangeToMode command. + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml index a5e1ea8e95..19fdceb111 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml @@ -34,26 +34,43 @@ limitations under the License. - EnergyBalances - + + + + + + - + - CurrentEnergyBalance + + + - EnergyPriorities + + + + + - LowPowerModeSensitivities + + + + + - + CurrentLowPowerModeSensitivity + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml index f2cf3173c6..5474ebaba2 100644 --- a/src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml @@ -37,26 +37,60 @@ limitations under the License. The Ethernet Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. - + + + + + + + + + - - + + - - - - PHYRate - FullDuplex - PacketRxCount - PacketTxCount - TxErrCount - CollisionCount - OverrunCount - CarrierDetect - TimeSinceReset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reception of this command SHALL reset the attributes: PacketRxCount, PacketTxCount, TxErrCount, CollisionCount, OverrunCount to 0 + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml index 96e420f019..67506a1827 100644 --- a/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml @@ -31,6 +31,8 @@ limitations under the License. FIXED_LABEL_CLUSTER The Fixed Label Cluster provides a feature for the device to tag an endpoint with zero or more read only labels. - LabelList + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/flow-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/flow-measurement-cluster.xml index 3e546e9685..14b22a16b1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/flow-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/flow-measurement-cluster.xml @@ -24,10 +24,18 @@ limitations under the License. FLOW_MEASUREMENT_CLUSTER true true - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - Tolerance + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml index 167f7d13e3..f7f81c3f59 100644 --- a/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml @@ -52,45 +52,80 @@ limitations under the License. - - Breadcrumb + + - BasicCommissioningInfo - RegulatoryConfig - LocationCapability - SupportsConcurrentConnection - - TCAcceptedVersion + + + + + + + + + + + + + + + + + + + - - TCMinRequiredVersion + + + + + + + - - TCAcknowledgements + + + + + + + - - TCAcknowledgementsRequired + + + + + + + - - TCUpdateDeadline + + + + + + + Arm the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock + Success/failure response for ArmFailSafe command + Set the regulatory configuration to be used during commissioning @@ -98,30 +133,46 @@ limitations under the License. + Success/failure response for SetRegulatoryConfig command + Signals the Server that the Client has successfully completed all steps of Commissioning/Recofiguration needed during fail-safe period. + Indicates to client whether CommissioningComplete command succeeded + This command sets the user acknowledgements received in the Enhanced Setup Flow Terms and Conditions into the node. + + + + + + This command is used to convey the result from SetTCAcknowledgements. + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml index 26f0e5708d..c3bae609c6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml @@ -92,17 +92,35 @@ limitations under the License. - NetworkInterfaces - RebootCount + + + + + + - UpTime - TotalOperationalHours - BootReason - ActiveHardwareFaults - ActiveRadioFaults - ActiveNetworkFaults - TestEventTriggersEnabled + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -> -> -> -> -> - - - - - - IdleModeDuration - ActiveModeDuration - ActiveModeThreshold - - RegisteredClients - - - - ICDCounter - - - ClientsSupportedPerFabric - UserActiveModeTriggerHint - UserActiveModeTriggerInstruction - OperatingMode - MaximumCheckInBackOff - - - Register a client to the end device - - - - - - - - - - RegisterClient response command - - - - - Unregister a client from an end device - - - - - - - Request the end device to stay in Active Mode for an additional ActiveModeThreshold - - - - - - StayActiveRequest response command - - - + + General + ICD Management + 0x0046 + ICD_MANAGEMENT_CLUSTER + Allows servers to ensure that listed clients are notified when a server is available for communication. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Register a client to the end device + + + + + + + + + + + + + RegisterClient response command + + + + + + + + Unregister a client from an end device + + + + + + + + + + Request the end device to stay in Active Mode for an additional ActiveModeThreshold + + + + + + + + + + + + StayActiveRequest response command + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/identify-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/identify-cluster.xml index b64eb7702f..e2a2a7fd59 100644 --- a/src/app/zap-templates/zcl/data-model/chip/identify-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/identify-cluster.xml @@ -51,16 +51,21 @@ limitations under the License. true true - - IdentifyTime - IdentifyType - + + + + + + + + Command description for Identify + @@ -69,6 +74,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/illuminance-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/illuminance-measurement-cluster.xml index b744964ca0..be373be05c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/illuminance-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/illuminance-measurement-cluster.xml @@ -18,19 +18,29 @@ limitations under the License. - Illuminance Measurement - Measurement & Sensing - Attributes and commands for configuring the measurement of illuminance, and reporting illuminance measurements. - 0x0400 - ILLUMINANCE_MEASUREMENT_CLUSTER - true - true - - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - Tolerance - LightSensorType + Illuminance Measurement + Measurement & Sensing + Attributes and commands for configuring the measurement of illuminance, and reporting illuminance measurements. + 0x0400 + ILLUMINANCE_MEASUREMENT_CLUSTER + true + true + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/keypad-input-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/keypad-input-cluster.xml index b43ace5c0c..c21a58ca0f 100644 --- a/src/app/zap-templates/zcl/data-model/chip/keypad-input-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/keypad-input-cluster.xml @@ -40,11 +40,13 @@ limitations under the License. Upon receipt, this SHALL process a keycode as input to the media device. + This command SHALL be generated in response to a SendKey Request command. + diff --git a/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml index f126d8836f..e18476fdb2 100644 --- a/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/laundry-dryer-controls-cluster.xml @@ -36,9 +36,13 @@ limitations under the License. This cluster provides a way to access options associated with the operation of a laundry dryer device type. - - - SupportedDrynessLevels - SelectedDrynessLevel - + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/laundry-washer-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/laundry-washer-mode-cluster.xml index b8afd87d76..8ceab13055 100644 --- a/src/app/zap-templates/zcl/data-model/chip/laundry-washer-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/laundry-washer-mode-cluster.xml @@ -58,11 +58,15 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + StartUpMode OnMode - + @@ -70,6 +74,7 @@ limitations under the License. On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + @@ -78,6 +83,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/level-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/level-control-cluster.xml index 4d0e67ddbd..448b5ff0c9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/level-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/level-control-cluster.xml @@ -61,25 +61,63 @@ limitations under the License. - - CurrentLevel - RemainingTime - MinLevel - MaxLevel - CurrentFrequency - MinFrequency - MaxFrequency - - OnOffTransitionTime - OnLevel - OnTransitionTime - OffTransitionTime - DefaultMoveRate - Options - - StartUpCurrentLevel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -90,6 +128,7 @@ limitations under the License. + @@ -100,6 +139,7 @@ limitations under the License. + @@ -111,6 +151,7 @@ limitations under the License. + @@ -119,6 +160,7 @@ limitations under the License. + @@ -129,6 +171,7 @@ limitations under the License. + @@ -139,6 +182,7 @@ limitations under the License. + @@ -150,6 +194,7 @@ limitations under the License. + @@ -158,6 +203,7 @@ limitations under the License. + @@ -166,6 +212,9 @@ limitations under the License. approximation if the exact provided one is not possible. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/localization-configuration-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/localization-configuration-cluster.xml index 9bdededd0f..bd1149e9b0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/localization-configuration-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/localization-configuration-cluster.xml @@ -28,10 +28,12 @@ limitations under the License. standards. As such, Nodes that visually or audibly convey information need a mechanism by which they can be configured to use a user’s preferred language, units, etc - - ActiveLocale + + + + + - SupportedLocales diff --git a/src/app/zap-templates/zcl/data-model/chip/low-power-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/low-power-cluster.xml index c1cc5b38ed..4b9ea09104 100644 --- a/src/app/zap-templates/zcl/data-model/chip/low-power-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/low-power-cluster.xml @@ -26,6 +26,7 @@ limitations under the License. This cluster provides an interface for managing low power mode on a device. This command shall put the device into low power mode. + diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index bdccfbe39e..54fe73d5f0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -40,7 +40,6 @@ limitations under the License. ACL - EXTENSION DATA_MODEL_REVISION @@ -293,7 +292,6 @@ limitations under the License. CURRENT_LEVEL OPTIONS LEVEL_CONTROL_REMAINING_TIME - MINIMUM_LEVEL ON_LEVEL START_UP_CURRENT_LEVEL MoveToLevel @@ -394,7 +392,6 @@ limitations under the License. CURRENT_LEVEL OPTIONS LEVEL_CONTROL_REMAINING_TIME - MINIMUM_LEVEL ON_LEVEL START_UP_CURRENT_LEVEL MoveToLevel @@ -492,7 +489,6 @@ limitations under the License. CURRENT_LEVEL OPTIONS LEVEL_CONTROL_REMAINING_TIME - MINIMUM_LEVEL ON_LEVEL START_UP_CURRENT_LEVEL MoveToLevel @@ -609,7 +605,6 @@ limitations under the License. CURRENT_LEVEL OPTIONS LEVEL_CONTROL_REMAINING_TIME - MINIMUM_LEVEL ON_LEVEL START_UP_CURRENT_LEVEL MoveToLevel @@ -742,7 +737,6 @@ limitations under the License. CURRENT_LEVEL OPTIONS LEVEL_CONTROL_REMAINING_TIME - MINIMUM_LEVEL ON_LEVEL START_UP_CURRENT_LEVEL MoveToLevel @@ -836,7 +830,6 @@ limitations under the License. CURRENT_LEVEL OPTIONS LEVEL_CONTROL_REMAINING_TIME - MINIMUM_LEVEL ON_LEVEL START_UP_CURRENT_LEVEL MoveToLevel @@ -2162,7 +2155,7 @@ limitations under the License. - + MA-oven CHIP Oven @@ -2258,7 +2251,7 @@ limitations under the License. - + MA-laundry-dryer CHIP Laundry Dryer @@ -2451,7 +2444,6 @@ limitations under the License. - MA-all-clusters-app CHIP @@ -2670,7 +2662,7 @@ limitations under the License. - + Energy EVSE CHIP EVSE @@ -2689,11 +2681,11 @@ limitations under the License. Device Energy Management CHIP Device Energy Management - Simple + Utility 0x0103 0x050D + Endpoint - diff --git a/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml index 597b285cc1..1e1da73365 100644 --- a/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml @@ -32,20 +32,27 @@ limitations under the License. - InputList - CurrentInput + + + + + + Upon receipt, this SHALL change the input on the media device to the input at a specific index in the Input List. + Upon receipt, this SHALL display the active status of the input list on screen. + Upon receipt, this SHALL hide the input list from the screen. + @@ -53,6 +60,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/media-playback-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/media-playback-cluster.xml index a77b8fa4be..9e0896f777 100644 --- a/src/app/zap-templates/zcl/data-model/chip/media-playback-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/media-playback-cluster.xml @@ -46,87 +46,156 @@ limitations under the License. - CurrentState - StartTime - Duration - SampledPosition - PlaybackSpeed - SeekRangeEnd - SeekRangeStart - ActiveAudioTrack - AvailableAudioTracks - ActiveTextTrack - AvailableTextTracks + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Upon receipt, this SHALL play media. + Upon receipt, this SHALL pause media. + Upon receipt, this SHALL stop media. User experience is context-specific. This will often navigate the user back to the location where media was originally launched. + Upon receipt, this SHALL Start Over with the current media playback item. + Upon receipt, this SHALL cause the handler to be invoked for "Previous". User experience is context-specific. This will often Go back to the previous media playback item. + Upon receipt, this SHALL cause the handler to be invoked for "Next". User experience is context-specific. This will often Go forward to the next media playback item. + Upon receipt, this SHALL Rewind through media. Different Rewind speeds can be used on the TV based upon the number of sequential calls to this function. This is to avoid needing to define every speed now (multiple fast, slow motion, etc). + + + Upon receipt, this SHALL Advance through media. Different FF speeds can be used on the TV based upon the number of sequential calls to this function. This is to avoid needing to define every speed now (multiple fast, slow motion, etc). + + + Upon receipt, this SHALL Skip forward in the media by the given number of seconds, using the data as follows: + Upon receipt, this SHALL Skip backward in the media by the given number of seconds, using the data as follows: + Upon receipt, this SHALL Skip backward in the media by the given number of seconds, using the data as follows: + + + This command SHALL be generated in response to various Playback Request commands. + Upon receipt, the server SHALL set the active Audio Track to the one identified by the TrackID in the Track catalog for the streaming media. If the TrackID does not exist in the Track catalog, OR does not correspond to the streaming media OR no media is being streamed at the time of receipt of this command, the server will return an error status of INVALID_ARGUMENT. + + + Upon receipt, the server SHALL set the active Text Track to the one identified by the TrackID in the Track catalog for the streaming media. If the TrackID does not exist in the Track catalog, OR does not correspond to the streaming media OR no media is being streamed at the time of receipt of this command, the server SHALL return an error status of INVALID_ARGUMENT. + + + If a Text Track is active (i.e. being displayed), upon receipt of this command, the server SHALL stop displaying it. + + + @@ -140,6 +209,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml index 741ba801f5..5258167488 100644 --- a/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml @@ -91,8 +91,12 @@ limitations under the License. - Messages - ActiveMessageIDs + + + + + + Command for requesting messages be presented @@ -104,20 +108,24 @@ limitations under the License. + Command for cancelling message present requests + This event SHALL be generated when the message is confirmed by the user, or when the expiration date of the message is reached. + This event SHALL be generated when the message is presented to the user. + This event SHALL be generated when the message is confirmed by the user, or when the expiration date of the message is reached. @@ -125,6 +133,7 @@ limitations under the License. + - \ No newline at end of file + diff --git a/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml index 954bd898b6..6ee5fac92c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml @@ -41,27 +41,65 @@ limitations under the License. - CookTime - MaxCookTime - PowerSetting - MinPower - MaxPower - PowerStep - SupportedWatts - SelectedWattIndex - WattRating - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Set Cooking Parameters + Set Cooking Parameters + - Add More Cooking Time - + Add More Cooking Time + + diff --git a/src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml index 856fde36da..f217da4160 100644 --- a/src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml @@ -55,7 +55,11 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml index 443acb1c95..adc776dbe6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml @@ -48,19 +48,33 @@ limitations under the License. Attributes and commands for selecting a mode from a list of supported options. - Description - StandardNamespace - SupportedModes - CurrentMode - StartUpMode - OnMode - + + + + + + + + + + + + + + + + + + + + On receipt of this command, if the NewMode field matches the Mode field in an entry of the SupportedModes list, the server SHALL set the CurrentMode attribute to the NewMode value, otherwise, the server SHALL respond with an INVALID_COMMAND status response. + diff --git a/src/app/zap-templates/zcl/data-model/chip/network-commissioning-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/network-commissioning-cluster.xml index 964923be4f..33533dfa24 100644 --- a/src/app/zap-templates/zcl/data-model/chip/network-commissioning-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/network-commissioning-cluster.xml @@ -107,120 +107,196 @@ limitations under the License. - - + + + + - - MaxNetworks + + - - Networks + + + + + + + + + + + + + + + + + + - ScanMaxTimeSeconds - ConnectMaxTimeSeconds - - InterfaceEnabled + + - - LastNetworkingStatus + + - - LastNetworkID + + - - LastConnectErrorValue + + - - SupportedWiFiBands + + + + - - SupportedThreadFeatures + + + + - - ThreadVersion + + + + - - Detemine the set of networks the device sees as available. - - - - - - Relay the set of networks the device sees as available back to the client. - - - - - - - Add or update the credentials for a given Wi-Fi network. - - - - - - - - - - Add or update the credentials for a given Thread network. - - - - - - Remove the definition of a given network (including its credentials). - - - - - - Response command for various commands that add/remove/modify network credentials. - - - - - - - - Connect to the specified network, using previously-defined credentials. - - - - - - Command that indicates whether we have succcessfully connected to a network. - - - - - - Modify the order in which networks will be presented in the Networks attribute. - - - - - - - Retrieve details about and optionally proof of possession of a network client identity. - - - - - - Command that contains details about a network client identity and optionally a proof of possession. - - - - + + Detemine the set of networks the device sees as available. + + + + + + + + + + + + Relay the set of networks the device sees as available back to the client. + + + + + + + + + + + + + Add or update the credentials for a given Wi-Fi network. + + + + + + + + + + + + + Add or update the credentials for a given Thread network. + + + + + + + + + Remove the definition of a given network (including its credentials). + + + + + + + + + + + + Response command for various commands that add/remove/modify network credentials. + + + + + + + + + + + + + + Connect to the specified network, using previously-defined credentials. + + + + + + + + + + + + Command that indicates whether we have succcessfully connected to a network. + + + + + + + + + + + + Modify the order in which networks will be presented in the Networks attribute. + + + + + + + + + + + + + Retrieve details about and optionally proof of possession of a network client identity. + + + + + + + + + Command that contains details about a network client identity and optionally a proof of possession. + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml index 0141a7542f..414eb2c287 100644 --- a/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml @@ -83,74 +83,274 @@ limitations under the License. - Occupancy - OccupancySensorType - OccupancySensorTypeBitmap - - - HoldTime - + + + + + + + + + + + + + + - HoldTimeLimits + + + + - - PIROccupiedToUnoccupiedDelay + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - PIRUnoccupiedToOccupiedDelay + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - PIRUnoccupiedToOccupiedThreshold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - UltrasonicOccupiedToUnoccupiedDelay + + + + + + + + + + - - UltrasonicUnoccupiedToOccupiedDelay + + + + + + + + + + + + + + + + + - - UltrasonicUnoccupiedToOccupiedThreshold + + + + + + + + + + + + + + + + + - - PhysicalContactOccupiedToUnoccupiedDelay + + + + + + + + + + - - PhysicalContactUnoccupiedToOccupiedDelay + + + + + + + + + + + + + + + + + - - PhysicalContactUnoccupiedToOccupiedThreshold + + + + + + + + + + + + + + + + + If this event is supported, it SHALL be generated when the Occupancy attribute changes. + diff --git a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml index 04dcfed837..6ed5cfec07 100644 --- a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml @@ -81,37 +81,70 @@ limitations under the License. - - OnOff - GlobalSceneControl - OnTime - OffWaitTime - - StartUpOnOff + + + + + + + + + + + + + + + + + + + + + + + On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0. + On receipt of this command, a device SHALL enter its ‘On’ state. This state is device dependent, but it is recommended that it is used for power on or similar functions. On receipt of the On command, if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. + + + + + On receipt of this command, if a device is in its ‘Off’ state it SHALL enter its ‘On’ state. Otherwise, if it is in its ‘On’ state it SHALL enter its ‘Off’ state. On receipt of the Toggle command, if the value of the OnOff attribute is equal to FALSE and if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. If the value of the OnOff attribute is equal to TRUE, the OnTime attribute SHALL be set to 0. + + + + + The OffWithEffect command allows devices to be turned off using enhanced ways of fading. + + + The OnWithRecallGlobalScene command allows the recall of the settings when the device was turned off. + + + @@ -119,6 +152,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml index 5b06c93e0a..61dd99e58b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-credentials-cluster.xml @@ -59,37 +59,51 @@ limitations under the License. OPERATIONAL_CREDENTIALS_CLUSTER This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the associated Fabrics. - - NOCs + + + + + + + + + + + + + + + + + - Fabrics - SupportedFabrics - CommissionedFabrics - TrustedRootCertificates - CurrentFabricIndex Sender is requesting attestation information from the receiver. + An attestation information confirmation from the server. + Sender is requesting a device attestation certificate from the receiver. + A device attestation certificate (DAC) or product attestation intermediate (PAI) certificate from the server. + @@ -97,6 +111,7 @@ limitations under the License. + @@ -104,6 +119,7 @@ limitations under the License. A certificate signing request (CSR) from the server. + @@ -114,6 +130,7 @@ limitations under the License. + @@ -121,31 +138,36 @@ limitations under the License. + - + Response to AddNOC or UpdateNOC commands. + This command SHALL be used by an Administrative Node to set the user-visible Label field for a given Fabric, as reflected by entries in the Fabrics attribute. + This command is used by Administrative Nodes to remove a given fabric index and delete all associated fabric-scoped data. + This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation. + diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-state-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-state-cluster.xml index 53b9c73cad..07b874e462 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-state-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-state-cluster.xml @@ -58,47 +58,88 @@ limitations under the License. true true This cluster supports remotely monitoring and, where supported, changing the operational state of any device where a state machine is a part of the operation. - - - - PhaseList - CurrentPhase - CountdownTime - OperationalStateList - OperationalState - OperationalError - + + + + + + + + + + + + + + + + + + + + + + Upon receipt, the device SHALL pause its operation if it is possible based on the current function of the server. + + + + + + Upon receipt, the device SHALL stop its operation if it is at a position where it is safe to do so and/or permitted. + + + + + + Upon receipt, the device SHALL start its operation if it is safe to do so and the device is in an operational state from which it can be started. + Upon receipt, the device SHALL resume its operation from the point it was at when it received the Pause command, or from the point when it was paused by means outside of this cluster (for example by manual button press). + + + + + + This command SHALL be generated in response to any of the Start, Stop, Pause, or Resume commands. + + + + + + + + OperationalError - + + OperationCompletion - + + diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-state-oven-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-state-oven-cluster.xml index fd52204b02..0b18947c5d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-state-oven-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-state-oven-cluster.xml @@ -53,13 +53,25 @@ limitations under the License. This cluster supports remotely monitoring and, where supported, changing the operational state of an Oven. - - PhaseList - CurrentPhase - CountdownTime - OperationalStateList - OperationalState - OperationalError + + + + + + + + + + + + + + + + + + + Upon receipt, the device SHALL pause its operation if it is possible based on the current function of the server. @@ -67,10 +79,17 @@ limitations under the License. Upon receipt, the device SHALL stop its operation if it is at a position where it is safe to do so and/or permitted. + + + + + + Upon receipt, the device SHALL start its operation if it is safe to do so and the device is in an operational state from which it can be started. + @@ -80,18 +99,28 @@ limitations under the License. This command SHALL be generated in response to any of the Start, Stop, Pause, or Resume commands. + + + + + + + + OperationalError - + + OperationCompletion - + + diff --git a/src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster.xml index e3b054fe3f..bf09a56329 100644 --- a/src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster.xml @@ -64,24 +64,42 @@ limitations under the License. true true This cluster supports remotely monitoring and, where supported, changing the operational state of a Robotic Vacuum. - - - - PhaseList - CurrentPhase - CountdownTime - OperationalStateList - - - OperationalState - OperationalError + + + + + + Upon receipt, the device SHALL pause its operation if it is possible based on the current function of the server. + + + + + + @@ -90,27 +108,47 @@ both values from this cluster and from the base cluster. Upon receipt, the device SHALL resume its operation from the point it was at when it received the Pause command, or from the point when it was paused by means outside of this cluster (for example by manual button press). + + + + + + This command SHALL be generated in response to any of the Start, Stop, Pause, or Resume commands. + + + + + + + + On receipt of this command, the device SHALL start seeking the charging dock, if possible in the current state of the device. + + + + OperationalError - + + - + OperationCompletion - - + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/oven-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/oven-mode-cluster.xml index 0faa1b037e..ff71dcc12c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/oven-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/oven-mode-cluster.xml @@ -62,11 +62,15 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + StartUpMode OnMode - + @@ -74,6 +78,7 @@ limitations under the License. On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + @@ -82,6 +87,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml index 5701dc6ec6..16b0c0c307 100644 --- a/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml @@ -43,58 +43,190 @@ limitations under the License. - - Status - Order - Description - - WiredAssessedInputVoltage - WiredAssessedInputFrequency - WiredCurrentType - WiredAssessedCurrent - WiredNominalVoltage - WiredMaximumCurrent - WiredPresent - ActiveWiredFaults - - BatVoltage - BatPercentRemaining - BatTimeRemaining - BatChargeLevel - BatReplacementNeeded - BatReplaceability - BatPresent - ActiveBatFaults - BatReplacementDescription - BatCommonDesignation - BatANSIDesignation - BatIECDesignation - BatApprovedChemistry - BatCapacity - BatQuantity - BatChargeState - BatTimeToFullCharge - BatFunctionalWhileCharging - BatChargingCurrent - ActiveBatChargeFaults - EndpointList + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The WiredFaultChange Event SHALL indicate a change in the set of wired faults currently detected by the Node on this wired power source. + + + The BatFaultChange Event SHALL indicate a change in the set of battery faults currently detected by the Node on this battery power source. + + + The BatChargeFaultChange Event SHALL indicate a change in the set of charge faults currently detected by the Node on this battery power source. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/power-source-configuration-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/power-source-configuration-cluster.xml index 04a7cdb121..ee99575b3b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/power-source-configuration-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/power-source-configuration-cluster.xml @@ -26,6 +26,8 @@ limitations under the License. true true - Sources + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml index 3bca0bd43e..9d5aa74931 100644 --- a/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml @@ -44,7 +44,15 @@ limitations under the License. - AvailableEndpoints - ActiveEndpoints + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/pressure-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/pressure-measurement-cluster.xml index f9487af7f3..61f9ccc140 100644 --- a/src/app/zap-templates/zcl/data-model/chip/pressure-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/pressure-measurement-cluster.xml @@ -31,16 +31,44 @@ limitations under the License. - - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - Tolerance - ScaledValue - MinScaledValue - MaxScaledValue - ScaledTolerance - Scale + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/pump-configuration-and-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/pump-configuration-and-control-cluster.xml index 74416092e7..0158c4077d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/pump-configuration-and-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/pump-configuration-and-control-cluster.xml @@ -49,97 +49,222 @@ limitations under the License. - - MaxPressure - MaxSpeed - MaxFlow - MinConstPressure - MaxConstPressure - MinCompPressure - MaxCompPressure - MinConstSpeed - MaxConstSpeed - MinConstFlow - MaxConstFlow - MinConstTemp - MaxConstTemp - PumpStatus - EffectiveOperationMode - EffectiveControlMode - Capacity - Speed - - LifetimeRunningHours + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Power - - LifetimeEnergyConsumed + + - - OperationMode + + - - ControlMode + + SupplyVoltageLow + SupplyVoltageHigh + PowerMissingPhase + SystemPressureLow + SystemPressureHigh + DryRunning + MotorTemperatureHigh + PumpMotorFatalFailure + ElectronicTemperatureHigh + PumpBlocked + SensorFailure + ElectronicNonFatalFailure + ElectronicFatalFailure + GeneralFault + Leakage + AirDetection + TurbineOperation + diff --git a/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml b/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml index 58fa70163f..ca091a5dea 100644 --- a/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml +++ b/src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml @@ -28,17 +28,24 @@ limitations under the License. REFRIGERATOR_ALARM_CLUSTER true true - - Mask - State - Supported + + + + + + + + + + - Notify - - - - + Notify + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/refrigerator-and-temperature-controlled-cabinet-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/refrigerator-and-temperature-controlled-cabinet-mode-cluster.xml index e29080ce4a..7ed1160ce7 100644 --- a/src/app/zap-templates/zcl/data-model/chip/refrigerator-and-temperature-controlled-cabinet-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/refrigerator-and-temperature-controlled-cabinet-mode-cluster.xml @@ -56,11 +56,15 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + StartUpMode OnMode - + @@ -68,6 +72,7 @@ limitations under the License. On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + @@ -76,6 +81,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/relative-humidity-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/relative-humidity-measurement-cluster.xml index e309b75dcc..047258fcbb 100644 --- a/src/app/zap-templates/zcl/data-model/chip/relative-humidity-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/relative-humidity-measurement-cluster.xml @@ -25,9 +25,17 @@ limitations under the License. true true - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - Tolerance + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml index 66de9ee66c..d85bf3dfb5 100644 --- a/src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml @@ -38,16 +38,35 @@ limitations under the License. - Condition - DegradationDirection - ChangeIndication - InPlaceIndicator - LastChangedTime - ReplacementProductList - + + + + + + + + + + + + + + + + + + + + + + + + + Reset the condition of the replaceable to the non degraded state + @@ -73,16 +92,35 @@ limitations under the License. - Condition - DegradationDirection - ChangeIndication - InPlaceIndicator - LastChangedTime - ReplacementProductList - + + + + + + + + + + + + + + + + + + + + + + + + + Reset the condition of the replaceable to the non degraded state + diff --git a/src/app/zap-templates/zcl/data-model/chip/rvc-clean-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/rvc-clean-mode-cluster.xml index 65c2f17a3e..f3ac53b22d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/rvc-clean-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/rvc-clean-mode-cluster.xml @@ -67,8 +67,12 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + @@ -78,6 +82,7 @@ limitations under the License. On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + @@ -86,6 +91,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/rvc-run-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/rvc-run-mode-cluster.xml index ce83557639..2ca053546c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/rvc-run-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/rvc-run-mode-cluster.xml @@ -73,8 +73,12 @@ limitations under the License. - SupportedModes - CurrentMode + + + + + + @@ -84,6 +88,7 @@ limitations under the License. On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + @@ -92,6 +97,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/scene.xml b/src/app/zap-templates/zcl/data-model/chip/scene.xml index b6315bdc12..ceea35e375 100644 --- a/src/app/zap-templates/zcl/data-model/chip/scene.xml +++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml @@ -80,10 +80,16 @@ limitations under the License. - - LastConfiguredBy - SceneTableSize - FabricSceneInfo + + + + + + + + + + Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' @@ -94,6 +100,7 @@ limitations under the License. + @@ -102,6 +109,7 @@ limitations under the License. + @@ -111,6 +119,7 @@ limitations under the License. + @@ -119,6 +128,7 @@ limitations under the License. + @@ -128,6 +138,7 @@ limitations under the License. + @@ -137,6 +148,7 @@ limitations under the License. + @@ -144,6 +156,7 @@ limitations under the License. Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to get the used scene identifiers within a certain group + @@ -155,6 +168,7 @@ limitations under the License. + @@ -164,6 +178,7 @@ limitations under the License. + @@ -176,6 +191,7 @@ limitations under the License. + @@ -185,6 +201,7 @@ limitations under the License. + @@ -193,6 +210,7 @@ limitations under the License. + @@ -202,6 +220,7 @@ limitations under the License. + @@ -212,6 +231,7 @@ limitations under the License. + @@ -221,6 +241,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml index 8c2ba832c8..f74647a260 100644 --- a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml @@ -96,19 +96,37 @@ limitations under the License. - SupportedAreas - SupportedMaps - SelectedAreas - CurrentArea - EstimatedEndTime - Progress - + + + + + + + + + + + + + + + + + + + + + + + + Command used to select a set of device areas, where the device is to operate. + @@ -117,6 +135,7 @@ limitations under the License. + @@ -132,6 +151,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml index 31ae0bba9e..e5a3afb75d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml @@ -46,66 +46,118 @@ limitations under the License. - ExpressedState - SmokeState - COState - BatteryAlert - DeviceMuted - TestInProgress - HardwareFaultAlert - EndOfServiceAlert - InterconnectSmokeAlarm - InterconnectCOAlarm - ContaminationState - - SmokeSensitivityLevel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - ExpiryDate - + + + + This command SHALL initiate a device self-test. + This event SHALL be generated when SmokeState attribute changes to either Warning or Critical state. + + + This event SHALL be generated when COState attribute changes to either Warning or Critical state. + + + This event SHALL be generated when BatteryAlert attribute changes to either Warning or Critical state. + This event SHALL be generated when the device detects a hardware fault that leads to setting HardwareFaultAlert to True. + This event SHALL be generated when the EndOfServiceAlert is set to Expired. + This event SHALL be generated when the SelfTest completes, and the attribute TestInProgress changes to False. + This event SHALL be generated when the DeviceMuted attribute changes to Muted. + This event SHALL be generated when DeviceMuted attribute changes to NotMuted. + This event SHALL be generated when the device hosting the server receives a smoke alarm from an interconnected sensor. + + + This event SHALL be generated when the device hosting the server receives a smoke alarm from an interconnected sensor. + + + This event SHALL be generated when ExpressedState attribute returns to Normal state. + diff --git a/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml index 3ac2ba42e8..9d4026187f 100644 --- a/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml @@ -37,20 +37,34 @@ limitations under the License. - ThreadMetrics - CurrentHeapFree - CurrentHeapUsed - CurrentHeapHighWatermark + + + + + + + + + + + + + + Reception of this command SHALL reset the values: The StackFreeMinimum field of the ThreadMetrics attribute, CurrentHeapHighWaterMark attribute. + + + Indicate the last software fault that has taken place on the Node. - + + diff --git a/src/app/zap-templates/zcl/data-model/chip/switch-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/switch-cluster.xml index 176163fae7..1ab3f1d950 100644 --- a/src/app/zap-templates/zcl/data-model/chip/switch-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/switch-cluster.xml @@ -78,38 +78,72 @@ Interactions with the switch device are exposed as attributes (for the latching - NumberOfPositions - CurrentPosition - MultiPressMax + + + + + + + + + + + SwitchLatched + + + InitialPress + + + LongPress + + + ShortRelease + + + LongRelease + + + MultiPressOngoing + + + + + + + + MultiPressComplete - + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml index bc665905df..86edb7478d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/target-navigator-cluster.xml @@ -25,19 +25,25 @@ limitations under the License. true This cluster provides an interface for UX navigation within a set of targets on a device or endpoint. - TargetList - CurrentTarget - + + + + + + + Upon receipt, this SHALL navigation the UX to the target identified. + This command SHALL be generated in response to NavigateTarget commands. + @@ -45,6 +51,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml index da0c0bcee9..b3f7b6a86b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml @@ -40,17 +40,42 @@ limitations under the License. - TemperatureSetpoint - MinTemperature - MaxTemperature - Step - SelectedTemperatureLevel - SupportedTemperatureLevels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Set Temperature - - + Set Temperature + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/temperature-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/temperature-measurement-cluster.xml index d141743faf..8b5a4ac730 100644 --- a/src/app/zap-templates/zcl/data-model/chip/temperature-measurement-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/temperature-measurement-cluster.xml @@ -24,9 +24,17 @@ limitations under the License. TEMPERATURE_MEASUREMENT_CLUSTER true true - MeasuredValue - MinMeasuredValue - MaxMeasuredValue - Tolerance + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index 6f75aa45e9..d52c730d05 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -312,146 +312,308 @@ limitations under the License. - LocalTemperature - OutdoorTemperature - Occupancy - AbsMinHeatSetpointLimit - AbsMaxHeatSetpointLimit - AbsMinCoolSetpointLimit - AbsMaxCoolSetpointLimit - PICoolingDemand - PIHeatingDemand - - HVACSystemTypeConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - LocalTemperatureCalibration + + + + + + - OccupiedCoolingSetpoint - OccupiedHeatingSetpoint - UnoccupiedCoolingSetpoint - UnoccupiedHeatingSetpoint - - MinHeatSetpointLimit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - MaxHeatSetpointLimit + + + + - - MinCoolSetpointLimit + + + + - - MaxCoolSetpointLimit + + + + - - MinSetpointDeadBand + + + + - - RemoteSensing + + - - ControlSequenceOfOperation + + - - SystemMode + + + + + + + - ThermostatRunningMode - StartOfWeek - NumberOfWeeklyTransitions - NumberOfDailyTransitions - - TemperatureSetpointHold + + + + + + + + + + + + + + + + + - - TemperatureSetpointHoldDuration + + - - ThermostatProgrammingOperationMode + + + + + - ThermostatRunningState - SetpointChangeSource - SetpointChangeAmount - SetpointChangeSourceTimestamp - - OccupiedSetback + + + + + + + + + + + + + + + + + + + + + + + - OccupiedSetbackMin - OccupiedSetbackMax - - UnoccupiedSetback + + + + + + + - UnoccupiedSetbackMin - UnoccupiedSetbackMax - - EmergencyHeatDelta + + + + + + + + + + + + + + + + + + - - ACType + + - - ACCapacity + + - - ACRefrigerantType + + - - ACCompressorType + + - - ACErrorCode + + - - ACLouverPosition + + - ACCoilTemperature - - ACCapacityformat + + + + + + + + + + - PresetTypes - ScheduleTypes - NumberOfPresets - NumberOfSchedules - NumberOfScheduleTransitions - NumberOfScheduleTransitionPerDay - ActivePresetHandle - ActiveScheduleHandle - - Presets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Schedules + + + + + + + - SetpointHoldExpiryTimestamp Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. + @@ -461,27 +623,42 @@ limitations under the License. + + + The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. + + + This command is used to clear the weekly schedule. + + + Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. + + + ID + + + @@ -491,6 +668,9 @@ limitations under the License. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml index cd3491cc07..ed0b412570 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml @@ -29,18 +29,20 @@ limitations under the License. - TemperatureDisplayMode - - - KeypadLockout + + + + + + - - ScheduleProgrammingVisibility + + diff --git a/src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml index d05ce70c34..38612b5eb6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml @@ -33,31 +33,46 @@ limitations under the License. - BorderRouterName - - BorderAgentID - - ThreadVersion - - InterfaceEnabled - - ActiveDatasetTimestamp - - PendingDatasetTimestamp - + + + + + + + + + + + + + + + + + + + + + + + + Command to request the active operational dataset of the Thread network to which the border router is connected. This command must be sent over a valid CASE session + Command to request the pending dataset of the Thread network to which the border router is connected. This command must be sent over a valid CASE session + - + Generated response to GetActiveDatasetRequest or GetPendingDatasetRequest commands. + @@ -65,12 +80,16 @@ limitations under the License. + Command set or update the pending Dataset of the Thread network to which the Border Router is connected. + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml index 77ec869961..943f69f58f 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml @@ -107,82 +107,299 @@ limitations under the License. - - Channel - RoutingRole - NetworkName - PanId - ExtendedPanId - MeshLocalPrefix - OverrunCount - NeighborTable - RouteTable - PartitionId - Weighting - DataVersion - StableDataVersion - LeaderRouterId - DetachedRoleCount - ChildRoleCount - RouterRoleCount - LeaderRoleCount - AttachAttemptCount - PartitionIdChangeCount - BetterPartitionAttachAttemptCount - ParentChangeCount - TxTotalCount - TxUnicastCount - TxBroadcastCount - TxAckRequestedCount - TxAckedCount - TxNoAckRequestedCount - TxDataCount - TxDataPollCount - TxBeaconCount - TxBeaconRequestCount - TxOtherCount - TxRetryCount - TxDirectMaxRetryExpiryCount - TxIndirectMaxRetryExpiryCount - TxErrCcaCount - TxErrAbortCount - TxErrBusyChannelCount - RxTotalCount - RxUnicastCount - RxBroadcastCount - RxDataCount - RxDataPollCount - RxBeaconCount - RxBeaconRequestCount - RxOtherCount - RxAddressFilteredCount - RxDestAddrFilteredCount - RxDuplicatedCount - RxErrNoFrameCount - RxErrUnknownNeighborCount - RxErrInvalidSrcAddrCount - RxErrSecCount - RxErrFcsCount - RxErrOtherCount - ActiveTimestamp - PendingTimestamp - Delay - SecurityPolicy - ChannelPage0Mask - OperationalDatasetComponents - ActiveNetworkFaultsList + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reception of this command SHALL reset the OverrunCount attributes to 0 + + + Indicate that a Node’s connection status to a Thread network has changed + Indicate a change in the set of network faults currently detected by the Node + diff --git a/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml index 3a6445b15b..2b00af3102 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml @@ -15,58 +15,64 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + + + + + + + + - - - - - - - + + Network Infrastructure + Thread Network Directory + 0x0453 + THREAD_NETWORK_DIRECTORY_CLUSTER + Manages the names and credentials of Thread networks visible to the user. - - Network Infrastructure - Thread Network Directory - 0x0453 - THREAD_NETWORK_DIRECTORY_CLUSTER - Manages the names and credentials of Thread networks visible to the user. + true + true - true - true + + + + + + + + + + + + + + + - - - - - PreferredExtendedPanID - - - - - ThreadNetworks - - - ThreadNetworkTableSize - - - Adds an entry to the ThreadNetworks list. - - - - - Removes an entry from the ThreadNetworks list. - - - - - Retrieves a Thread Operational Dataset from the ThreadNetworks list. - - - - - This is the response to a GetOperationalDataset request. - - - + + Adds an entry to the ThreadNetworks list. + + + + + + Removes an entry from the ThreadNetworks list. + + + + + + Retrieves a Thread Operational Dataset from the ThreadNetworks list. + + + + + + This is the response to a GetOperationalDataset request. + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml index 6ade7abe2e..b71b710b70 100644 --- a/src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml @@ -58,14 +58,20 @@ limitations under the License. - - HourFormat - + + + - - ActiveCalendarType - + + + + + + + + + + - SupportedCalendarTypes 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 9336a6a944..a352b2a181 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 @@ -114,78 +114,153 @@ limitations under the License. - UTCTime - Granularity - TimeSource - 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/data-model/chip/unit-localization-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml index fb6238add4..d79a265f63 100644 --- a/src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml @@ -42,9 +42,11 @@ limitations under the License. - - TemperatureUnit - + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml index 24260b7830..acea3035a4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml @@ -23,10 +23,10 @@ limitations under the License. 0x0041 USER_LABEL_CLUSTER The User Label Cluster provides a feature to tag an endpoint with zero or more labels. - - LabelList + + diff --git a/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml index 80c1cdb60c..6656876c99 100644 --- a/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/valve-configuration-and-control-cluster.xml @@ -59,39 +59,75 @@ limitations under the License. - OpenDuration + + + - DefaultOpenDuration - AutoCloseTime - RemainingDuration - CurrentState - TargetState - CurrentLevel - TargetLevel - DefaultOpenLevel - ValveFault - LevelStep - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This command is used to set the valve to its open position. + This command is used to set the valve to its closed position. + This event SHALL be generated when the valve state changed. + This event SHALL be generated when the valve registers or clears a fault. + diff --git a/src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml index 90bd18b5b7..700f25b198 100644 --- a/src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml @@ -27,8 +27,12 @@ limitations under the License. - - MACAddress - LinkLocalAddress + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml index 2dc01920ae..d566acb28c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml @@ -45,11 +45,27 @@ limitations under the License. - - SpinSpeeds - SpinSpeedCurrent - NumberOfRinses - SupportedRinses + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml index beeaf277b7..60fc9ce3e0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml @@ -64,30 +64,52 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 true - HeaterTypes - HeatDemand - TankVolume - EstimatedHeatRequired - TankPercentage - BoostState + + + + + + + + + + + + + + + + + + + + + + + + Allows a client to request that the water heater is put into a Boost state. + Allows a client to cancel an ongoing Boost operation. + This event SHALL be generated whenever a Boost command is accepted. + This event SHALL be generated whenever the BoostState transitions from Active to Inactive. + diff --git a/src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml index d9211e8084..a1d3b27255 100644 --- a/src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml @@ -58,18 +58,24 @@ Git: 1.4-prerelease-ipr-69-ge15ff5700 - SupportedModes - CurrentMode + + + + + + This command is used to change device modes. + This command is sent by the device on receipt of the ChangeToMode command. + diff --git a/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml index 7fb35aab25..784568337b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml @@ -63,35 +63,81 @@ limitations under the License. - - BSSID - SecurityType - WiFiVersion - ChannelNumber - RSSI - BeaconLostCount - BeaconRxCount - PacketMulticastRxCount - PacketMulticastTxCount - PacketUnicastRxCount - PacketUnicastTxCount - CurrentMaxRate - OverrunCount + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reception of this command SHALL reset the Breacon and Packet related count attributes to 0 + + + Indicate that a Node’s Wi-Fi connection has been disconnected as a result of de-authenticated or dis-association and indicates the reason. + Indicate that a Node has failed to connect, or reconnect, to a Wi-Fi access point. + Indicate that a Node’s connection status to a Wi-Fi network has changed. + diff --git a/src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml index 8c8b4d40c3..1c14050fc2 100644 --- a/src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml @@ -30,19 +30,23 @@ limitations under the License. - SSID - - PassphraseSurrogate + + + + + Request the current WPA-Personal passphrase or PSK associated with the managed Wi-Fi network. + This is the response to a NetworkPassphraseRequest. + diff --git a/src/app/zap-templates/zcl/data-model/chip/window-covering.xml b/src/app/zap-templates/zcl/data-model/chip/window-covering.xml index 0e1c97a4d4..5795e8efc3 100644 --- a/src/app/zap-templates/zcl/data-model/chip/window-covering.xml +++ b/src/app/zap-templates/zcl/data-model/chip/window-covering.xml @@ -57,91 +57,251 @@ limitations under the License. - Type + + + - PhysicalClosedLimitLift + + + + + + + + + - PhysicalClosedLimitTilt + + + + + + + + + - CurrentPositionLift + + + + + + + + + - CurrentPositionTilt + + + + + + + + + - NumberOfActuationsLift + + + + + - NumberOfActuationsTilt + + + + + - ConfigStatus + + + - CurrentPositionLiftPercentage + + + + + + + + - CurrentPositionTiltPercentage + + + + + + + + - OperationalStatus + + + - TargetPositionLiftPercent100ths + + + + + + + + - TargetPositionTiltPercent100ths + + + + + + + + - EndProductType + + + - CurrentPositionLiftPercent100ths + + + + + + + + - CurrentPositionTiltPercent100ths - + + + + + + + + - InstalledOpenLimitLift - InstalledClosedLimitLift + + + + + + + + + + + + + + + + + + - InstalledOpenLimitTilt - InstalledClosedLimitTilt + + + + + + + + + + + + + + + + + + - - Mode + - + + - SafetyStatus - + + + + Moves window covering to InstalledOpenLimitLift and InstalledOpenLimitTilt + Moves window covering to InstalledClosedLimitLift and InstalledCloseLimitTilt + Stop any adjusting of window covering + Go to lift value specified + + + + + + Go to lift percentage specified + + + + + + + + + + + Go to tilt value specified + + + + + + Go to tilt percentage specified + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml index 27a947b561..32e9a4b18a 100644 --- a/src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml @@ -18,7 +18,7 @@ limitations under the License. XML generated by Alchemy; DO NOT EDIT. Source: src/app_clusters/ZoneManagement.adoc Parameters: in-progress -Git: 0.9-fall2024-302-gebc8548b3 +Git: 1.4-282-gad46b0990 --> @@ -78,12 +78,13 @@ Git: 0.9-fall2024-302-gebc8548b3 - + + @@ -94,16 +95,19 @@ Git: 0.9-fall2024-302-gebc8548b3 This cluster provides an interface to manage regions of interest, or Zones, which can be either manufacturer or user defined. true - - + + + + + true SupportedZoneSources Zones - TimeControl - Sensitivity + Triggers + Sensitivity This command SHALL create and store a TwoD Cartesian Zone. @@ -148,7 +152,7 @@ Git: 0.9-fall2024-302-gebc8548b3 - This event SHALL be generated when either when the TriggerDetectedDuration value is exceeded by the TimeSinceInitialTrigger value or when the MaxDuration value is exceeded by the TimeSinceInitialTrigger value as described in ZoneTriggeringTimeControlStruct. + This event SHALL be generated when either when the TriggerDetectedDuration value is exceeded by the TimeSinceInitialTrigger value or when the MaxDuration value is exceeded by the TimeSinceInitialTrigger value as described in ZoneTriggerControlStruct. 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 0eba8fc692..39301cdc30 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -196,6 +196,7 @@ "MaxPathsPerInvoke" ], "Bridged Device Basic Information": ["ProductAppearance"], + "Chime": ["ActiveChimeID", "Enabled"], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 6907cfea0e..c2de6acabf 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -190,6 +190,7 @@ "MaxPathsPerInvoke" ], "Bridged Device Basic Information": ["ProductAppearance"], + "Chime": ["ActiveChimeID", "Enabled"], "Descriptor": ["ClusterRevision", "FeatureMap"], "Device Energy Management": [ "ESAType", diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index e38e880961..4de99f1b7a 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -171,7 +171,7 @@ "concentration-measurement-server" ], "CHANNEL_CLUSTER": ["channel-server"], - "CHIME_CLUSTER": [], + "CHIME_CLUSTER": ["chime-server"], "COLOR_CONTROL_CLUSTER": ["color-control-server"], "COMMISSIONER_CONTROL_CLUSTER": ["commissioner-control-server"], "COMMISSIONING_CLUSTER": [], diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 2ec020340e..0536856468 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -204,6 +204,16 @@ class DLL_EXPORT DeviceController : public AbstractDnssdDiscoveryController return nullptr; } + CASESessionManager * CASESessionMgr() + { + if (mSystemState) + { + return mSystemState->CASESessionMgr(); + } + + return nullptr; + } + Messaging::ExchangeManager * ExchangeMgr() { if (mSystemState != nullptr) diff --git a/src/controller/CHIPDeviceControllerSystemState.h b/src/controller/CHIPDeviceControllerSystemState.h index e040ad1461..0a6476ff38 100644 --- a/src/controller/CHIPDeviceControllerSystemState.h +++ b/src/controller/CHIPDeviceControllerSystemState.h @@ -201,7 +201,7 @@ class DeviceControllerSystemState // // The stack will shut down when all references are released. // - // NB: The system state is owned by the factory; Relase() will not free it + // NB: The system state is owned by the factory; Release() will not free it // but will free its members (Shutdown()). // // Returns true if the system state was shut down in response to this call. diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 24c7e00c62..95f102ce08 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -9443,6 +9443,7 @@ provisional cluster ZoneManagement = 1360 { bitmap Feature : bitmap32 { kTwoDimensionalCartesianZone = 0x1; + kPerZoneSensitivity = 0x2; } struct TwoDCartesianVertexStruct { @@ -9463,11 +9464,12 @@ provisional cluster ZoneManagement = 1360 { ZoneSourceEnum zoneSource = 2; } - struct ZoneTriggeringTimeControlStruct { + struct ZoneTriggerControlStruct { int16u initialDuration = 0; int16u augmentationDuration = 1; elapsed_s maxDuration = 2; int16u blindDuration = 3; + optional int8u sensitivity = 4; } info event ZoneTriggered = 0 { @@ -9482,8 +9484,8 @@ provisional cluster ZoneManagement = 1360 { readonly attribute ZoneSourceEnum supportedZoneSources[] = 0; readonly attribute optional ZoneInformationStruct zones[] = 1; - attribute ZoneTriggeringTimeControlStruct timeControl[] = 2; - attribute int8u sensitivity = 3; + attribute ZoneTriggerControlStruct triggers[] = 2; + attribute optional int8u sensitivity = 3; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -9566,12 +9568,12 @@ provisional cluster CameraAvStreamManagement = 1361 { } bitmap Feature : bitmap32 { - kPrivacy = 0x1; - kAudio = 0x2; - kSpeaker = 0x4; - kImageControl = 0x8; - kVideo = 0x10; - kSnapshot = 0x20; + kAudio = 0x1; + kVideo = 0x2; + kSnapshot = 0x4; + kPrivacy = 0x8; + kSpeaker = 0x10; + kImageControl = 0x20; kWatermark = 0x40; kOnScreenDisplay = 0x80; kLocalStorage = 0x100; @@ -9715,27 +9717,23 @@ provisional cluster CameraAvStreamManagement = 1361 { readonly attribute optional boolean hardPrivacyModeOn = 23; attribute access(read: manage, write: manage) optional TriStateAutoEnum nightVision = 24; attribute access(read: manage, write: manage) optional TriStateAutoEnum nightVisionIllum = 25; - attribute access(read: manage, write: manage) optional boolean AWBEnabled = 26; - attribute access(read: manage, write: manage) optional boolean autoShutterSpeedEnabled = 27; - attribute access(read: manage, write: manage) optional boolean autoISOEnabled = 28; - readonly attribute optional ViewportStruct viewport = 29; - attribute access(read: manage, write: manage) optional boolean speakerMuted = 30; - attribute access(read: manage, write: manage) optional int8u speakerVolumeLevel = 31; - attribute access(read: manage, write: manage) optional int8u speakerMaxLevel = 32; - attribute access(read: manage, write: manage) optional int8u speakerMinLevel = 33; - attribute access(read: manage, write: manage) optional boolean microphoneMuted = 34; - attribute access(read: manage, write: manage) optional int8u microphoneVolumeLevel = 35; - attribute access(read: manage, write: manage) optional int8u microphoneMaxLevel = 36; - attribute access(read: manage, write: manage) optional int8u microphoneMinLevel = 37; - attribute access(read: manage, write: manage) optional boolean microphoneAGCEnabled = 38; - readonly attribute optional int16u imageRotation = 39; - readonly attribute optional boolean imageFlipHorizontal = 40; - readonly attribute optional boolean imageFlipVertical = 41; - attribute access(read: manage, write: manage) optional boolean localVideoRecordingEnabled = 42; - attribute access(read: manage, write: manage) optional boolean localSnapshotRecordingEnabled = 43; - attribute access(read: manage, write: manage) optional boolean statusLightEnabled = 44; - attribute access(read: manage, write: manage) optional ThreeLevelAutoEnum statusLightBrightness = 45; - attribute access(read: manage, write: manage) optional TriStateAutoEnum depthSensorStatus = 46; + attribute access(read: manage, write: manage) optional ViewportStruct viewport = 26; + attribute access(read: manage, write: manage) optional boolean speakerMuted = 27; + attribute access(read: manage, write: manage) optional int8u speakerVolumeLevel = 28; + readonly attribute access(read: manage) optional int8u speakerMaxLevel = 29; + readonly attribute access(read: manage) optional int8u speakerMinLevel = 30; + attribute access(read: manage, write: manage) optional boolean microphoneMuted = 31; + attribute access(read: manage, write: manage) optional int8u microphoneVolumeLevel = 32; + readonly attribute access(read: manage) optional int8u microphoneMaxLevel = 33; + readonly attribute access(read: manage) optional int8u microphoneMinLevel = 34; + attribute access(read: manage, write: manage) optional boolean microphoneAGCEnabled = 35; + attribute access(read: manage, write: manage) optional int16u imageRotation = 36; + attribute access(read: manage, write: manage) optional boolean imageFlipHorizontal = 37; + attribute access(read: manage, write: manage) optional boolean imageFlipVertical = 38; + attribute access(read: manage, write: manage) optional boolean localVideoRecordingEnabled = 39; + attribute access(read: manage, write: manage) optional boolean localSnapshotRecordingEnabled = 40; + attribute access(read: manage, write: manage) optional boolean statusLightEnabled = 41; + attribute access(read: manage, write: manage) optional ThreeLevelAutoEnum statusLightBrightness = 42; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -9822,22 +9820,6 @@ provisional cluster CameraAvStreamManagement = 1361 { VideoResolutionStruct resolution = 2; } - request struct SetViewportRequest { - ViewportStruct viewport = 0; - } - - request struct SetImageRotationRequest { - int16u angle = 0; - } - - request struct SetImageFlipHorizontalRequest { - boolean enabled = 0; - } - - request struct SetImageFlipVerticalRequest { - boolean enabled = 0; - } - /** This command SHALL allocate an audio stream on the camera and return an allocated audio stream identifier. */ command access(invoke: manage) AudioStreamAllocate(AudioStreamAllocateRequest): AudioStreamAllocateResponse = 0; /** This command SHALL deallocate an audio stream on the camera, corresponding to the given audio stream identifier. */ @@ -9855,15 +9837,7 @@ provisional cluster CameraAvStreamManagement = 1361 { /** This command SHALL set the relative priorities of the various stream types on the camera. */ command access(invoke: administer) SetStreamPriorities(SetStreamPrioritiesRequest): DefaultSuccess = 10; /** This command SHALL return a Snapshot from the camera. */ - command access(invoke: manage) CaptureSnapshot(CaptureSnapshotRequest): DefaultSuccess = 11; - /** This command sets the viewport in all video streams. */ - command access(invoke: manage) SetViewport(SetViewportRequest): DefaultSuccess = 13; - /** The data fields for this command SHALL be as follows: */ - command access(invoke: manage) SetImageRotation(SetImageRotationRequest): DefaultSuccess = 14; - /** The data fields for this command SHALL be as follows: */ - command access(invoke: manage) SetImageFlipHorizontal(SetImageFlipHorizontalRequest): DefaultSuccess = 15; - /** The data fields for this command SHALL be as follows: */ - command access(invoke: manage) SetImageFlipVertical(SetImageFlipVerticalRequest): DefaultSuccess = 16; + command CaptureSnapshot(CaptureSnapshotRequest): DefaultSuccess = 11; } /** The WebRTC transport provider cluster provides a way for stream providers (e.g. Cameras) to stream or receive their data through WebRTC. */ diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 1a1f853926..8c1eba9907 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -2955,6 +2955,25 @@ } ] }, + { + "name": "Chime", + "code": 1366, + "mfgCode": null, + "define": "CHIME_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "PlayChimeSound", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ] + }, { "name": "Unit Testing", "code": 4294048773, diff --git a/src/controller/java/AndroidDeviceControllerWrapper.cpp b/src/controller/java/AndroidDeviceControllerWrapper.cpp index ba0342629a..3eb6dd82e4 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.cpp +++ b/src/controller/java/AndroidDeviceControllerWrapper.cpp @@ -42,9 +42,7 @@ #include #include #include -#ifndef JAVA_MATTER_CONTROLLER_TEST -#include -#endif // JAVA_MATTER_CONTROLLER_TEST + using namespace chip; using namespace chip::Controller; using namespace chip::Credentials; @@ -52,15 +50,14 @@ using namespace TLV; AndroidDeviceControllerWrapper::~AndroidDeviceControllerWrapper() { + getICDClientStorage()->Shutdown(); mController->Shutdown(); -#ifndef JAVA_MATTER_CONTROLLER_TEST if (mKeypairBridge != nullptr) { chip::Platform::Delete(mKeypairBridge); mKeypairBridge = nullptr; } -#endif // JAVA_MATTER_CONTROLLER_TEST if (mDeviceAttestationDelegateBridge != nullptr) { @@ -298,7 +295,6 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew( // The lifetime of the ephemeralKey variable must be kept until SetupParams is saved. Crypto::P256Keypair ephemeralKey; -#ifndef JAVA_MATTER_CONTROLLER_TEST if (rootCertificate != nullptr && nodeOperationalCertificate != nullptr && keypairDelegate != nullptr) { CHIPP256KeypairBridge * nativeKeypairBridge = wrapper->GetP256KeypairBridge(); @@ -335,7 +331,6 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew( setupParams.controllerNOC = chip::ByteSpan(wrapper->mNocCertificate.data(), wrapper->mNocCertificate.size()); } else -#endif // JAVA_MATTER_CONTROLLER_TEST { ChipLogProgress(Controller, "No existing credentials provided: generating ephemeral local NOC chain with OperationalCredentialsIssuer"); diff --git a/src/controller/java/AndroidDeviceControllerWrapper.h b/src/controller/java/AndroidDeviceControllerWrapper.h index 02d50499bb..93374a1e0f 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.h +++ b/src/controller/java/AndroidDeviceControllerWrapper.h @@ -28,19 +28,18 @@ #include #include #include +#include #include #include #include #include #include #include - #ifdef JAVA_MATTER_CONTROLLER_TEST #include #include #else #include -#include #endif // JAVA_MATTER_CONTROLLER_TEST #include "AndroidCheckInDelegate.h" @@ -71,7 +70,6 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel jobject JavaObjectRef() { return mJavaObjectRef.ObjectRef(); } jlong ToJNIHandle(); -#ifndef JAVA_MATTER_CONTROLLER_TEST /** * Returns a CHIPP256KeypairBridge which can be used to delegate signing operations * to a KeypairDelegate in the Java layer. Note that this will always return a pointer @@ -85,7 +83,6 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel } return mKeypairBridge; } -#endif // JAVA_MATTER_CONTROLLER_TEST void CallJavaIntMethod(const char * methodName, jint argument); void CallJavaLongMethod(const char * methodName, jlong argument); @@ -235,12 +232,12 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel JavaVM * mJavaVM = nullptr; chip::JniGlobalReference mJavaObjectRef; + CHIPP256KeypairBridge * mKeypairBridge = nullptr; #ifdef JAVA_MATTER_CONTROLLER_TEST ExampleOperationalCredentialsIssuerPtr mOpCredsIssuer; PersistentStorage mExampleStorage; #else AndroidOperationalCredentialsIssuerPtr mOpCredsIssuer; - CHIPP256KeypairBridge * mKeypairBridge = nullptr; #endif // JAVA_MATTER_CONTROLLER_TEST // These fields allow us to release the string/byte array memory later. diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 480e30f704..c1e05cff40 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -19,6 +19,7 @@ import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/build/chip/java/config.gni") import("${chip_root}/build/chip/java/rules.gni") import("${chip_root}/build/chip/tests.gni") +import("${chip_root}/src/app/codegen-data-model-provider/model.gni") import("${chip_root}/src/app/common_flags.gni") import("${chip_root}/src/platform/device.gni") @@ -136,6 +137,8 @@ shared_library("jni") { "AttestationTrustStoreBridge.cpp", "AttestationTrustStoreBridge.h", "CHIPDeviceController-JNI.cpp", + "CHIPP256KeypairBridge.cpp", + "CHIPP256KeypairBridge.h", "DeviceAttestation-JNI.cpp", "DeviceAttestationDelegateBridge.cpp", "DeviceAttestationDelegateBridge.h", @@ -169,6 +172,15 @@ shared_library("jni") { defines += [ "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1" ] deps += [ "${chip_root}/src/controller:nodatamodel" ] + + # Temporary dependency: InteractionModelEngine NEEDS a codegen data model instance + # defined and application is supposed to provide it. This adds the sources + # in the same way "data_model" implementations do + # + # DynamicDispatcher in src/app:interaction-model implements the actual required + # ember callbacks in this case... + sources += codegen_data_model_SOURCES + public_deps = codegen_data_model_PUBLIC_DEPS } else { deps += [ "${chip_root}/src/controller/data_model" ] } diff --git a/src/platform/android/CHIPP256KeypairBridge.cpp b/src/controller/java/CHIPP256KeypairBridge.cpp similarity index 98% rename from src/platform/android/CHIPP256KeypairBridge.cpp rename to src/controller/java/CHIPP256KeypairBridge.cpp index a6be8799ab..a73eb41720 100644 --- a/src/platform/android/CHIPP256KeypairBridge.cpp +++ b/src/controller/java/CHIPP256KeypairBridge.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "platform/android/CHIPP256KeypairBridge.h" +#include "CHIPP256KeypairBridge.h" #include "lib/core/CHIPError.h" #include "lib/support/CHIPJNIError.h" #include "lib/support/JniReferences.h" @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/src/platform/android/CHIPP256KeypairBridge.h b/src/controller/java/CHIPP256KeypairBridge.h similarity index 100% rename from src/platform/android/CHIPP256KeypairBridge.h rename to src/controller/java/CHIPP256KeypairBridge.h diff --git a/src/controller/java/OTAProviderDelegateBridge.cpp b/src/controller/java/OTAProviderDelegateBridge.cpp index 77bf3572e0..fe38cbdd92 100644 --- a/src/controller/java/OTAProviderDelegateBridge.cpp +++ b/src/controller/java/OTAProviderDelegateBridge.cpp @@ -154,11 +154,10 @@ void OTAProviderDelegateBridge::HandleQueryImage(CommandHandler * commandObj, co VendorId vendorId = commandData.vendorID; uint16_t productId = commandData.productID; uint32_t softwareVersion = commandData.softwareVersion; - DataModel::DecodableList protocolsSupported = commandData.protocolsSupported; - Optional hardwareVersion = commandData.hardwareVersion; - Optional location = commandData.location; - Optional requestorCanConsent = commandData.requestorCanConsent; - Optional metadataForProvider = commandData.metadataForProvider; + Optional hardwareVersion = commandData.hardwareVersion; + Optional location = commandData.location; + Optional requestorCanConsent = commandData.requestorCanConsent; + Optional metadataForProvider = commandData.metadataForProvider; bool isBDXProtocolSupported = false; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 06b8dd8ff0..a37be0ed91 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -59283,7 +59283,7 @@ public static class ZoneManagementCluster extends BaseChipCluster { private static final long SUPPORTED_ZONE_SOURCES_ATTRIBUTE_ID = 0L; private static final long ZONES_ATTRIBUTE_ID = 1L; - private static final long TIME_CONTROL_ATTRIBUTE_ID = 2L; + private static final long TRIGGERS_ATTRIBUTE_ID = 2L; private static final long SENSITIVITY_ATTRIBUTE_ID = 3L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -59422,8 +59422,8 @@ public interface ZonesAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public interface TimeControlAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public interface TriggersAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -59494,39 +59494,39 @@ public void onSuccess(byte[] tlv) { }, ZONES_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readTimeControlAttribute( - TimeControlAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TIME_CONTROL_ATTRIBUTE_ID); + public void readTriggersAttribute( + TriggersAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGERS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, TIME_CONTROL_ATTRIBUTE_ID, true); + }, TRIGGERS_ATTRIBUTE_ID, true); } - public void writeTimeControlAttribute(DefaultClusterCallback callback, ArrayList value) { - writeTimeControlAttribute(callback, value, 0); + public void writeTriggersAttribute(DefaultClusterCallback callback, ArrayList value) { + writeTriggersAttribute(callback, value, 0); } - public void writeTimeControlAttribute(DefaultClusterCallback callback, ArrayList value, int timedWriteTimeoutMs) { + public void writeTriggersAttribute(DefaultClusterCallback callback, ArrayList value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = ArrayType.generateArrayType(value, (elementvalue) -> elementvalue.encodeTlv()); - writeAttribute(new WriteAttributesCallbackImpl(callback), TIME_CONTROL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), TRIGGERS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } - public void subscribeTimeControlAttribute( - TimeControlAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TIME_CONTROL_ATTRIBUTE_ID); + public void subscribeTriggersAttribute( + TriggersAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGERS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, TIME_CONTROL_ATTRIBUTE_ID, minInterval, maxInterval); + }, TRIGGERS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readSensitivityAttribute( @@ -59750,27 +59750,23 @@ public static class CameraAvStreamManagementCluster extends BaseChipCluster { private static final long HARD_PRIVACY_MODE_ON_ATTRIBUTE_ID = 23L; private static final long NIGHT_VISION_ATTRIBUTE_ID = 24L; private static final long NIGHT_VISION_ILLUM_ATTRIBUTE_ID = 25L; - private static final long AWB_ENABLED_ATTRIBUTE_ID = 26L; - private static final long AUTO_SHUTTER_SPEED_ENABLED_ATTRIBUTE_ID = 27L; - private static final long AUTO_ISO_ENABLED_ATTRIBUTE_ID = 28L; - private static final long VIEWPORT_ATTRIBUTE_ID = 29L; - private static final long SPEAKER_MUTED_ATTRIBUTE_ID = 30L; - private static final long SPEAKER_VOLUME_LEVEL_ATTRIBUTE_ID = 31L; - private static final long SPEAKER_MAX_LEVEL_ATTRIBUTE_ID = 32L; - private static final long SPEAKER_MIN_LEVEL_ATTRIBUTE_ID = 33L; - private static final long MICROPHONE_MUTED_ATTRIBUTE_ID = 34L; - private static final long MICROPHONE_VOLUME_LEVEL_ATTRIBUTE_ID = 35L; - private static final long MICROPHONE_MAX_LEVEL_ATTRIBUTE_ID = 36L; - private static final long MICROPHONE_MIN_LEVEL_ATTRIBUTE_ID = 37L; - private static final long MICROPHONE_AGC_ENABLED_ATTRIBUTE_ID = 38L; - private static final long IMAGE_ROTATION_ATTRIBUTE_ID = 39L; - private static final long IMAGE_FLIP_HORIZONTAL_ATTRIBUTE_ID = 40L; - private static final long IMAGE_FLIP_VERTICAL_ATTRIBUTE_ID = 41L; - private static final long LOCAL_VIDEO_RECORDING_ENABLED_ATTRIBUTE_ID = 42L; - private static final long LOCAL_SNAPSHOT_RECORDING_ENABLED_ATTRIBUTE_ID = 43L; - private static final long STATUS_LIGHT_ENABLED_ATTRIBUTE_ID = 44L; - private static final long STATUS_LIGHT_BRIGHTNESS_ATTRIBUTE_ID = 45L; - private static final long DEPTH_SENSOR_STATUS_ATTRIBUTE_ID = 46L; + private static final long VIEWPORT_ATTRIBUTE_ID = 26L; + private static final long SPEAKER_MUTED_ATTRIBUTE_ID = 27L; + private static final long SPEAKER_VOLUME_LEVEL_ATTRIBUTE_ID = 28L; + private static final long SPEAKER_MAX_LEVEL_ATTRIBUTE_ID = 29L; + private static final long SPEAKER_MIN_LEVEL_ATTRIBUTE_ID = 30L; + private static final long MICROPHONE_MUTED_ATTRIBUTE_ID = 31L; + private static final long MICROPHONE_VOLUME_LEVEL_ATTRIBUTE_ID = 32L; + private static final long MICROPHONE_MAX_LEVEL_ATTRIBUTE_ID = 33L; + private static final long MICROPHONE_MIN_LEVEL_ATTRIBUTE_ID = 34L; + private static final long MICROPHONE_AGC_ENABLED_ATTRIBUTE_ID = 35L; + private static final long IMAGE_ROTATION_ATTRIBUTE_ID = 36L; + private static final long IMAGE_FLIP_HORIZONTAL_ATTRIBUTE_ID = 37L; + private static final long IMAGE_FLIP_VERTICAL_ATTRIBUTE_ID = 38L; + private static final long LOCAL_VIDEO_RECORDING_ENABLED_ATTRIBUTE_ID = 39L; + private static final long LOCAL_SNAPSHOT_RECORDING_ENABLED_ATTRIBUTE_ID = 40L; + private static final long STATUS_LIGHT_ENABLED_ATTRIBUTE_ID = 41L; + private static final long STATUS_LIGHT_BRIGHTNESS_ATTRIBUTE_ID = 42L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -60098,86 +60094,6 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void setViewport(DefaultClusterCallback callback, ChipStructs.CameraAvStreamManagementClusterViewportStruct viewport) { - setViewport(callback, viewport, 0); - } - - public void setViewport(DefaultClusterCallback callback, ChipStructs.CameraAvStreamManagementClusterViewportStruct viewport, int timedInvokeTimeoutMs) { - final long commandId = 13L; - - ArrayList elements = new ArrayList<>(); - final long viewportFieldID = 0L; - BaseTLVType viewporttlvValue = viewport.encodeTlv(); - elements.add(new StructElement(viewportFieldID, viewporttlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setImageRotation(DefaultClusterCallback callback, Integer angle) { - setImageRotation(callback, angle, 0); - } - - public void setImageRotation(DefaultClusterCallback callback, Integer angle, int timedInvokeTimeoutMs) { - final long commandId = 14L; - - ArrayList elements = new ArrayList<>(); - final long angleFieldID = 0L; - BaseTLVType angletlvValue = new UIntType(angle); - elements.add(new StructElement(angleFieldID, angletlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setImageFlipHorizontal(DefaultClusterCallback callback, Boolean enabled) { - setImageFlipHorizontal(callback, enabled, 0); - } - - public void setImageFlipHorizontal(DefaultClusterCallback callback, Boolean enabled, int timedInvokeTimeoutMs) { - final long commandId = 15L; - - ArrayList elements = new ArrayList<>(); - final long enabledFieldID = 0L; - BaseTLVType enabledtlvValue = new BooleanType(enabled); - elements.add(new StructElement(enabledFieldID, enabledtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setImageFlipVertical(DefaultClusterCallback callback, Boolean enabled) { - setImageFlipVertical(callback, enabled, 0); - } - - public void setImageFlipVertical(DefaultClusterCallback callback, Boolean enabled, int timedInvokeTimeoutMs) { - final long commandId = 16L; - - ArrayList elements = new ArrayList<>(); - final long enabledFieldID = 0L; - BaseTLVType enabledtlvValue = new BooleanType(enabled); - elements.add(new StructElement(enabledFieldID, enabledtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - public interface AudioStreamAllocateResponseCallback extends BaseClusterCallback { void onSuccess(Integer audioStreamID); } @@ -60992,111 +60908,6 @@ public void onSuccess(byte[] tlv) { }, NIGHT_VISION_ILLUM_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readAWBEnabledAttribute( - BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AWB_ENABLED_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, AWB_ENABLED_ATTRIBUTE_ID, true); - } - - public void writeAWBEnabledAttribute(DefaultClusterCallback callback, Boolean value) { - writeAWBEnabledAttribute(callback, value, 0); - } - - public void writeAWBEnabledAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new BooleanType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), AWB_ENABLED_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - - public void subscribeAWBEnabledAttribute( - BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AWB_ENABLED_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, AWB_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readAutoShutterSpeedEnabledAttribute( - BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AUTO_SHUTTER_SPEED_ENABLED_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, AUTO_SHUTTER_SPEED_ENABLED_ATTRIBUTE_ID, true); - } - - public void writeAutoShutterSpeedEnabledAttribute(DefaultClusterCallback callback, Boolean value) { - writeAutoShutterSpeedEnabledAttribute(callback, value, 0); - } - - public void writeAutoShutterSpeedEnabledAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new BooleanType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), AUTO_SHUTTER_SPEED_ENABLED_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - - public void subscribeAutoShutterSpeedEnabledAttribute( - BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AUTO_SHUTTER_SPEED_ENABLED_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, AUTO_SHUTTER_SPEED_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readAutoISOEnabledAttribute( - BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AUTO_ISO_ENABLED_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, AUTO_ISO_ENABLED_ATTRIBUTE_ID, true); - } - - public void writeAutoISOEnabledAttribute(DefaultClusterCallback callback, Boolean value) { - writeAutoISOEnabledAttribute(callback, value, 0); - } - - public void writeAutoISOEnabledAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new BooleanType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), AUTO_ISO_ENABLED_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - - public void subscribeAutoISOEnabledAttribute( - BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AUTO_ISO_ENABLED_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, AUTO_ISO_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readViewportAttribute( ViewportAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VIEWPORT_ATTRIBUTE_ID); @@ -61110,6 +60921,15 @@ public void onSuccess(byte[] tlv) { }, VIEWPORT_ATTRIBUTE_ID, true); } + public void writeViewportAttribute(DefaultClusterCallback callback, ChipStructs.CameraAvStreamManagementClusterViewportStruct value) { + writeViewportAttribute(callback, value, 0); + } + + public void writeViewportAttribute(DefaultClusterCallback callback, ChipStructs.CameraAvStreamManagementClusterViewportStruct value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value.encodeTlv(); + writeAttribute(new WriteAttributesCallbackImpl(callback), VIEWPORT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + public void subscribeViewportAttribute( ViewportAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VIEWPORT_ATTRIBUTE_ID); @@ -61206,15 +61026,6 @@ public void onSuccess(byte[] tlv) { }, SPEAKER_MAX_LEVEL_ATTRIBUTE_ID, true); } - public void writeSpeakerMaxLevelAttribute(DefaultClusterCallback callback, Integer value) { - writeSpeakerMaxLevelAttribute(callback, value, 0); - } - - public void writeSpeakerMaxLevelAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), SPEAKER_MAX_LEVEL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - public void subscribeSpeakerMaxLevelAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPEAKER_MAX_LEVEL_ATTRIBUTE_ID); @@ -61241,15 +61052,6 @@ public void onSuccess(byte[] tlv) { }, SPEAKER_MIN_LEVEL_ATTRIBUTE_ID, true); } - public void writeSpeakerMinLevelAttribute(DefaultClusterCallback callback, Integer value) { - writeSpeakerMinLevelAttribute(callback, value, 0); - } - - public void writeSpeakerMinLevelAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), SPEAKER_MIN_LEVEL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - public void subscribeSpeakerMinLevelAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPEAKER_MIN_LEVEL_ATTRIBUTE_ID); @@ -61346,15 +61148,6 @@ public void onSuccess(byte[] tlv) { }, MICROPHONE_MAX_LEVEL_ATTRIBUTE_ID, true); } - public void writeMicrophoneMaxLevelAttribute(DefaultClusterCallback callback, Integer value) { - writeMicrophoneMaxLevelAttribute(callback, value, 0); - } - - public void writeMicrophoneMaxLevelAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), MICROPHONE_MAX_LEVEL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - public void subscribeMicrophoneMaxLevelAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MICROPHONE_MAX_LEVEL_ATTRIBUTE_ID); @@ -61381,15 +61174,6 @@ public void onSuccess(byte[] tlv) { }, MICROPHONE_MIN_LEVEL_ATTRIBUTE_ID, true); } - public void writeMicrophoneMinLevelAttribute(DefaultClusterCallback callback, Integer value) { - writeMicrophoneMinLevelAttribute(callback, value, 0); - } - - public void writeMicrophoneMinLevelAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), MICROPHONE_MIN_LEVEL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - public void subscribeMicrophoneMinLevelAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MICROPHONE_MIN_LEVEL_ATTRIBUTE_ID); @@ -61451,6 +61235,15 @@ public void onSuccess(byte[] tlv) { }, IMAGE_ROTATION_ATTRIBUTE_ID, true); } + public void writeImageRotationAttribute(DefaultClusterCallback callback, Integer value) { + writeImageRotationAttribute(callback, value, 0); + } + + public void writeImageRotationAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), IMAGE_ROTATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + public void subscribeImageRotationAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, IMAGE_ROTATION_ATTRIBUTE_ID); @@ -61477,6 +61270,15 @@ public void onSuccess(byte[] tlv) { }, IMAGE_FLIP_HORIZONTAL_ATTRIBUTE_ID, true); } + public void writeImageFlipHorizontalAttribute(DefaultClusterCallback callback, Boolean value) { + writeImageFlipHorizontalAttribute(callback, value, 0); + } + + public void writeImageFlipHorizontalAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new BooleanType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), IMAGE_FLIP_HORIZONTAL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + public void subscribeImageFlipHorizontalAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, IMAGE_FLIP_HORIZONTAL_ATTRIBUTE_ID); @@ -61503,6 +61305,15 @@ public void onSuccess(byte[] tlv) { }, IMAGE_FLIP_VERTICAL_ATTRIBUTE_ID, true); } + public void writeImageFlipVerticalAttribute(DefaultClusterCallback callback, Boolean value) { + writeImageFlipVerticalAttribute(callback, value, 0); + } + + public void writeImageFlipVerticalAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new BooleanType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), IMAGE_FLIP_VERTICAL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + public void subscribeImageFlipVerticalAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, IMAGE_FLIP_VERTICAL_ATTRIBUTE_ID); @@ -61656,41 +61467,6 @@ public void onSuccess(byte[] tlv) { }, STATUS_LIGHT_BRIGHTNESS_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readDepthSensorStatusAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEPTH_SENSOR_STATUS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, DEPTH_SENSOR_STATUS_ATTRIBUTE_ID, true); - } - - public void writeDepthSensorStatusAttribute(DefaultClusterCallback callback, Integer value) { - writeDepthSensorStatusAttribute(callback, value, 0); - } - - public void writeDepthSensorStatusAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), DEPTH_SENSOR_STATUS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - - public void subscribeDepthSensorStatusAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEPTH_SENSOR_STATUS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, DEPTH_SENSOR_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index b3fcd6df3b..bbb319ba53 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -12952,26 +12952,30 @@ public String toString() { return output.toString(); } } -public static class ZoneManagementClusterZoneTriggeringTimeControlStruct { +public static class ZoneManagementClusterZoneTriggerControlStruct { public Integer initialDuration; public Integer augmentationDuration; public Long maxDuration; public Integer blindDuration; + public Optional sensitivity; private static final long INITIAL_DURATION_ID = 0L; private static final long AUGMENTATION_DURATION_ID = 1L; private static final long MAX_DURATION_ID = 2L; private static final long BLIND_DURATION_ID = 3L; + private static final long SENSITIVITY_ID = 4L; - public ZoneManagementClusterZoneTriggeringTimeControlStruct( + public ZoneManagementClusterZoneTriggerControlStruct( Integer initialDuration, Integer augmentationDuration, Long maxDuration, - Integer blindDuration + Integer blindDuration, + Optional sensitivity ) { this.initialDuration = initialDuration; this.augmentationDuration = augmentationDuration; this.maxDuration = maxDuration; this.blindDuration = blindDuration; + this.sensitivity = sensitivity; } public StructType encodeTlv() { @@ -12980,11 +12984,12 @@ public StructType encodeTlv() { values.add(new StructElement(AUGMENTATION_DURATION_ID, new UIntType(augmentationDuration))); values.add(new StructElement(MAX_DURATION_ID, new UIntType(maxDuration))); values.add(new StructElement(BLIND_DURATION_ID, new UIntType(blindDuration))); + values.add(new StructElement(SENSITIVITY_ID, sensitivity.map((nonOptionalsensitivity) -> new UIntType(nonOptionalsensitivity)).orElse(new EmptyType()))); return new StructType(values); } - public static ZoneManagementClusterZoneTriggeringTimeControlStruct decodeTlv(BaseTLVType tlvValue) { + public static ZoneManagementClusterZoneTriggerControlStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } @@ -12992,6 +12997,7 @@ public static ZoneManagementClusterZoneTriggeringTimeControlStruct decodeTlv(Bas Integer augmentationDuration = null; Long maxDuration = null; Integer blindDuration = null; + Optional sensitivity = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == INITIAL_DURATION_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -13013,20 +13019,26 @@ public static ZoneManagementClusterZoneTriggeringTimeControlStruct decodeTlv(Bas UIntType castingValue = element.value(UIntType.class); blindDuration = castingValue.value(Integer.class); } + } else if (element.contextTagNum() == SENSITIVITY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + sensitivity = Optional.of(castingValue.value(Integer.class)); + } } } - return new ZoneManagementClusterZoneTriggeringTimeControlStruct( + return new ZoneManagementClusterZoneTriggerControlStruct( initialDuration, augmentationDuration, maxDuration, - blindDuration + blindDuration, + sensitivity ); } @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("ZoneManagementClusterZoneTriggeringTimeControlStruct {\n"); + output.append("ZoneManagementClusterZoneTriggerControlStruct {\n"); output.append("\tinitialDuration: "); output.append(initialDuration); output.append("\n"); @@ -13039,6 +13051,9 @@ public String toString() { output.append("\tblindDuration: "); output.append(blindDuration); output.append("\n"); + output.append("\tsensitivity: "); + output.append(sensitivity); + output.append("\n"); output.append("}\n"); return output.toString(); } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 354f49ed6c..0f40fb5c32 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -16897,7 +16897,7 @@ public long getID() { public enum Attribute { SupportedZoneSources(0L), Zones(1L), - TimeControl(2L), + Triggers(2L), Sensitivity(3L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), @@ -17099,27 +17099,23 @@ public enum Attribute { HardPrivacyModeOn(23L), NightVision(24L), NightVisionIllum(25L), - AWBEnabled(26L), - AutoShutterSpeedEnabled(27L), - AutoISOEnabled(28L), - Viewport(29L), - SpeakerMuted(30L), - SpeakerVolumeLevel(31L), - SpeakerMaxLevel(32L), - SpeakerMinLevel(33L), - MicrophoneMuted(34L), - MicrophoneVolumeLevel(35L), - MicrophoneMaxLevel(36L), - MicrophoneMinLevel(37L), - MicrophoneAGCEnabled(38L), - ImageRotation(39L), - ImageFlipHorizontal(40L), - ImageFlipVertical(41L), - LocalVideoRecordingEnabled(42L), - LocalSnapshotRecordingEnabled(43L), - StatusLightEnabled(44L), - StatusLightBrightness(45L), - DepthSensorStatus(46L), + Viewport(26L), + SpeakerMuted(27L), + SpeakerVolumeLevel(28L), + SpeakerMaxLevel(29L), + SpeakerMinLevel(30L), + MicrophoneMuted(31L), + MicrophoneVolumeLevel(32L), + MicrophoneMaxLevel(33L), + MicrophoneMinLevel(34L), + MicrophoneAGCEnabled(35L), + ImageRotation(36L), + ImageFlipHorizontal(37L), + ImageFlipVertical(38L), + LocalVideoRecordingEnabled(39L), + LocalSnapshotRecordingEnabled(40L), + StatusLightEnabled(41L), + StatusLightBrightness(42L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -17177,11 +17173,7 @@ public enum Command { SnapshotStreamAllocate(7L), SnapshotStreamDeallocate(9L), SetStreamPriorities(10L), - CaptureSnapshot(11L), - SetViewport(13L), - SetImageRotation(14L), - SetImageFlipHorizontal(15L), - SetImageFlipVertical(16L),; + CaptureSnapshot(11L),; private final long id; Command(long id) { this.id = id; @@ -17352,74 +17344,6 @@ public static CaptureSnapshotCommandField value(int id) throws NoSuchFieldError } throw new NoSuchFieldError(); } - }public enum SetViewportCommandField {Viewport(0),; - private final int id; - SetViewportCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetViewportCommandField value(int id) throws NoSuchFieldError { - for (SetViewportCommandField field : SetViewportCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } - }public enum SetImageRotationCommandField {Angle(0),; - private final int id; - SetImageRotationCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetImageRotationCommandField value(int id) throws NoSuchFieldError { - for (SetImageRotationCommandField field : SetImageRotationCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } - }public enum SetImageFlipHorizontalCommandField {Enabled(0),; - private final int id; - SetImageFlipHorizontalCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetImageFlipHorizontalCommandField value(int id) throws NoSuchFieldError { - for (SetImageFlipHorizontalCommandField field : SetImageFlipHorizontalCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } - }public enum SetImageFlipVerticalCommandField {Enabled(0),; - private final int id; - SetImageFlipVerticalCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetImageFlipVerticalCommandField value(int id) throws NoSuchFieldError { - for (SetImageFlipVerticalCommandField field : SetImageFlipVerticalCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index d0e83258a3..d60e57afa2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -19955,7 +19955,7 @@ public void onError(Exception ex) { } } - public static class DelegatedZoneManagementClusterTimeControlAttributeCallback implements ChipClusters.ZoneManagementCluster.TimeControlAttributeCallback, DelegatedClusterCallback { + public static class DelegatedZoneManagementClusterTriggersAttributeCallback implements ChipClusters.ZoneManagementCluster.TriggersAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19963,9 +19963,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -29900,72 +29900,6 @@ public Map> getCommandMap() { ); cameraAvStreamManagementClusterInteractionInfoMap.put("captureSnapshot", cameraAvStreamManagementcaptureSnapshotInteractionInfo); - Map cameraAvStreamManagementsetViewportCommandParams = new LinkedHashMap(); - - InteractionInfo cameraAvStreamManagementsetViewportInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster) - .setViewport((DefaultClusterCallback) callback - , (ChipStructs.CameraAvStreamManagementClusterViewportStruct) - commandArguments.get("viewport") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - cameraAvStreamManagementsetViewportCommandParams - ); - cameraAvStreamManagementClusterInteractionInfoMap.put("setViewport", cameraAvStreamManagementsetViewportInteractionInfo); - - Map cameraAvStreamManagementsetImageRotationCommandParams = new LinkedHashMap(); - - CommandParameterInfo cameraAvStreamManagementsetImageRotationangleCommandParameterInfo = new CommandParameterInfo("angle", Integer.class, Integer.class); - cameraAvStreamManagementsetImageRotationCommandParams.put("angle",cameraAvStreamManagementsetImageRotationangleCommandParameterInfo); - InteractionInfo cameraAvStreamManagementsetImageRotationInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster) - .setImageRotation((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("angle") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - cameraAvStreamManagementsetImageRotationCommandParams - ); - cameraAvStreamManagementClusterInteractionInfoMap.put("setImageRotation", cameraAvStreamManagementsetImageRotationInteractionInfo); - - Map cameraAvStreamManagementsetImageFlipHorizontalCommandParams = new LinkedHashMap(); - - CommandParameterInfo cameraAvStreamManagementsetImageFlipHorizontalenabledCommandParameterInfo = new CommandParameterInfo("enabled", Boolean.class, Boolean.class); - cameraAvStreamManagementsetImageFlipHorizontalCommandParams.put("enabled",cameraAvStreamManagementsetImageFlipHorizontalenabledCommandParameterInfo); - InteractionInfo cameraAvStreamManagementsetImageFlipHorizontalInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster) - .setImageFlipHorizontal((DefaultClusterCallback) callback - , (Boolean) - commandArguments.get("enabled") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - cameraAvStreamManagementsetImageFlipHorizontalCommandParams - ); - cameraAvStreamManagementClusterInteractionInfoMap.put("setImageFlipHorizontal", cameraAvStreamManagementsetImageFlipHorizontalInteractionInfo); - - Map cameraAvStreamManagementsetImageFlipVerticalCommandParams = new LinkedHashMap(); - - CommandParameterInfo cameraAvStreamManagementsetImageFlipVerticalenabledCommandParameterInfo = new CommandParameterInfo("enabled", Boolean.class, Boolean.class); - cameraAvStreamManagementsetImageFlipVerticalCommandParams.put("enabled",cameraAvStreamManagementsetImageFlipVerticalenabledCommandParameterInfo); - InteractionInfo cameraAvStreamManagementsetImageFlipVerticalInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster) - .setImageFlipVertical((DefaultClusterCallback) callback - , (Boolean) - commandArguments.get("enabled") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - cameraAvStreamManagementsetImageFlipVerticalCommandParams - ); - cameraAvStreamManagementClusterInteractionInfoMap.put("setImageFlipVertical", cameraAvStreamManagementsetImageFlipVerticalInteractionInfo); - commandMap.put("cameraAvStreamManagement", cameraAvStreamManagementClusterInteractionInfoMap); Map webRTCTransportProviderClusterInteractionInfoMap = new LinkedHashMap<>(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 843114b437..eb1dcbafc1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -18204,17 +18204,17 @@ private static Map readZoneManagementInteractionInfo() readZoneManagementZonesCommandParams ); result.put("readZonesAttribute", readZoneManagementZonesAttributeInteractionInfo); - Map readZoneManagementTimeControlCommandParams = new LinkedHashMap(); - InteractionInfo readZoneManagementTimeControlAttributeInteractionInfo = new InteractionInfo( + Map readZoneManagementTriggersCommandParams = new LinkedHashMap(); + InteractionInfo readZoneManagementTriggersAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ZoneManagementCluster) cluster).readTimeControlAttribute( - (ChipClusters.ZoneManagementCluster.TimeControlAttributeCallback) callback + ((ChipClusters.ZoneManagementCluster) cluster).readTriggersAttribute( + (ChipClusters.ZoneManagementCluster.TriggersAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedZoneManagementClusterTimeControlAttributeCallback(), - readZoneManagementTimeControlCommandParams + () -> new ClusterInfoMapping.DelegatedZoneManagementClusterTriggersAttributeCallback(), + readZoneManagementTriggersCommandParams ); - result.put("readTimeControlAttribute", readZoneManagementTimeControlAttributeInteractionInfo); + result.put("readTriggersAttribute", readZoneManagementTriggersAttributeInteractionInfo); Map readZoneManagementSensitivityCommandParams = new LinkedHashMap(); InteractionInfo readZoneManagementSensitivityAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -18527,39 +18527,6 @@ private static Map readCameraAvStreamManagementInteract readCameraAvStreamManagementNightVisionIllumCommandParams ); result.put("readNightVisionIllumAttribute", readCameraAvStreamManagementNightVisionIllumAttributeInteractionInfo); - Map readCameraAvStreamManagementAWBEnabledCommandParams = new LinkedHashMap(); - InteractionInfo readCameraAvStreamManagementAWBEnabledAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).readAWBEnabledAttribute( - (ChipClusters.BooleanAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedBooleanAttributeCallback(), - readCameraAvStreamManagementAWBEnabledCommandParams - ); - result.put("readAWBEnabledAttribute", readCameraAvStreamManagementAWBEnabledAttributeInteractionInfo); - Map readCameraAvStreamManagementAutoShutterSpeedEnabledCommandParams = new LinkedHashMap(); - InteractionInfo readCameraAvStreamManagementAutoShutterSpeedEnabledAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).readAutoShutterSpeedEnabledAttribute( - (ChipClusters.BooleanAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedBooleanAttributeCallback(), - readCameraAvStreamManagementAutoShutterSpeedEnabledCommandParams - ); - result.put("readAutoShutterSpeedEnabledAttribute", readCameraAvStreamManagementAutoShutterSpeedEnabledAttributeInteractionInfo); - Map readCameraAvStreamManagementAutoISOEnabledCommandParams = new LinkedHashMap(); - InteractionInfo readCameraAvStreamManagementAutoISOEnabledAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).readAutoISOEnabledAttribute( - (ChipClusters.BooleanAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedBooleanAttributeCallback(), - readCameraAvStreamManagementAutoISOEnabledCommandParams - ); - result.put("readAutoISOEnabledAttribute", readCameraAvStreamManagementAutoISOEnabledAttributeInteractionInfo); Map readCameraAvStreamManagementSpeakerMutedCommandParams = new LinkedHashMap(); InteractionInfo readCameraAvStreamManagementSpeakerMutedAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -18736,17 +18703,6 @@ private static Map readCameraAvStreamManagementInteract readCameraAvStreamManagementStatusLightBrightnessCommandParams ); result.put("readStatusLightBrightnessAttribute", readCameraAvStreamManagementStatusLightBrightnessAttributeInteractionInfo); - Map readCameraAvStreamManagementDepthSensorStatusCommandParams = new LinkedHashMap(); - InteractionInfo readCameraAvStreamManagementDepthSensorStatusAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).readDepthSensorStatusAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readCameraAvStreamManagementDepthSensorStatusCommandParams - ); - result.put("readDepthSensorStatusAttribute", readCameraAvStreamManagementDepthSensorStatusAttributeInteractionInfo); Map readCameraAvStreamManagementGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readCameraAvStreamManagementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 725fd0baec..68d1f37921 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -3475,72 +3475,6 @@ public Map> getWriteAttributeMap() { writeCameraAvStreamManagementNightVisionIllumCommandParams ); writeCameraAvStreamManagementInteractionInfo.put("writeNightVisionIllumAttribute", writeCameraAvStreamManagementNightVisionIllumAttributeInteractionInfo); - Map writeCameraAvStreamManagementAWBEnabledCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementAWBEnabledCommandParameterInfo = - new CommandParameterInfo( - "value", - Boolean.class, - Boolean.class - ); - writeCameraAvStreamManagementAWBEnabledCommandParams.put( - "value", - cameraAvStreamManagementAWBEnabledCommandParameterInfo - ); - InteractionInfo writeCameraAvStreamManagementAWBEnabledAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeAWBEnabledAttribute( - (DefaultClusterCallback) callback, - (Boolean) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementAWBEnabledCommandParams - ); - writeCameraAvStreamManagementInteractionInfo.put("writeAWBEnabledAttribute", writeCameraAvStreamManagementAWBEnabledAttributeInteractionInfo); - Map writeCameraAvStreamManagementAutoShutterSpeedEnabledCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementautoShutterSpeedEnabledCommandParameterInfo = - new CommandParameterInfo( - "value", - Boolean.class, - Boolean.class - ); - writeCameraAvStreamManagementAutoShutterSpeedEnabledCommandParams.put( - "value", - cameraAvStreamManagementautoShutterSpeedEnabledCommandParameterInfo - ); - InteractionInfo writeCameraAvStreamManagementAutoShutterSpeedEnabledAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeAutoShutterSpeedEnabledAttribute( - (DefaultClusterCallback) callback, - (Boolean) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementAutoShutterSpeedEnabledCommandParams - ); - writeCameraAvStreamManagementInteractionInfo.put("writeAutoShutterSpeedEnabledAttribute", writeCameraAvStreamManagementAutoShutterSpeedEnabledAttributeInteractionInfo); - Map writeCameraAvStreamManagementAutoISOEnabledCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementautoISOEnabledCommandParameterInfo = - new CommandParameterInfo( - "value", - Boolean.class, - Boolean.class - ); - writeCameraAvStreamManagementAutoISOEnabledCommandParams.put( - "value", - cameraAvStreamManagementautoISOEnabledCommandParameterInfo - ); - InteractionInfo writeCameraAvStreamManagementAutoISOEnabledAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeAutoISOEnabledAttribute( - (DefaultClusterCallback) callback, - (Boolean) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementAutoISOEnabledCommandParams - ); - writeCameraAvStreamManagementInteractionInfo.put("writeAutoISOEnabledAttribute", writeCameraAvStreamManagementAutoISOEnabledAttributeInteractionInfo); Map writeCameraAvStreamManagementSpeakerMutedCommandParams = new LinkedHashMap(); CommandParameterInfo cameraAvStreamManagementspeakerMutedCommandParameterInfo = new CommandParameterInfo( @@ -3585,50 +3519,6 @@ public Map> getWriteAttributeMap() { writeCameraAvStreamManagementSpeakerVolumeLevelCommandParams ); writeCameraAvStreamManagementInteractionInfo.put("writeSpeakerVolumeLevelAttribute", writeCameraAvStreamManagementSpeakerVolumeLevelAttributeInteractionInfo); - Map writeCameraAvStreamManagementSpeakerMaxLevelCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementspeakerMaxLevelCommandParameterInfo = - new CommandParameterInfo( - "value", - Integer.class, - Integer.class - ); - writeCameraAvStreamManagementSpeakerMaxLevelCommandParams.put( - "value", - cameraAvStreamManagementspeakerMaxLevelCommandParameterInfo - ); - InteractionInfo writeCameraAvStreamManagementSpeakerMaxLevelAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeSpeakerMaxLevelAttribute( - (DefaultClusterCallback) callback, - (Integer) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementSpeakerMaxLevelCommandParams - ); - writeCameraAvStreamManagementInteractionInfo.put("writeSpeakerMaxLevelAttribute", writeCameraAvStreamManagementSpeakerMaxLevelAttributeInteractionInfo); - Map writeCameraAvStreamManagementSpeakerMinLevelCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementspeakerMinLevelCommandParameterInfo = - new CommandParameterInfo( - "value", - Integer.class, - Integer.class - ); - writeCameraAvStreamManagementSpeakerMinLevelCommandParams.put( - "value", - cameraAvStreamManagementspeakerMinLevelCommandParameterInfo - ); - InteractionInfo writeCameraAvStreamManagementSpeakerMinLevelAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeSpeakerMinLevelAttribute( - (DefaultClusterCallback) callback, - (Integer) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementSpeakerMinLevelCommandParams - ); - writeCameraAvStreamManagementInteractionInfo.put("writeSpeakerMinLevelAttribute", writeCameraAvStreamManagementSpeakerMinLevelAttributeInteractionInfo); Map writeCameraAvStreamManagementMicrophoneMutedCommandParams = new LinkedHashMap(); CommandParameterInfo cameraAvStreamManagementmicrophoneMutedCommandParameterInfo = new CommandParameterInfo( @@ -3673,72 +3563,94 @@ public Map> getWriteAttributeMap() { writeCameraAvStreamManagementMicrophoneVolumeLevelCommandParams ); writeCameraAvStreamManagementInteractionInfo.put("writeMicrophoneVolumeLevelAttribute", writeCameraAvStreamManagementMicrophoneVolumeLevelAttributeInteractionInfo); - Map writeCameraAvStreamManagementMicrophoneMaxLevelCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementmicrophoneMaxLevelCommandParameterInfo = + Map writeCameraAvStreamManagementMicrophoneAGCEnabledCommandParams = new LinkedHashMap(); + CommandParameterInfo cameraAvStreamManagementmicrophoneAGCEnabledCommandParameterInfo = new CommandParameterInfo( "value", - Integer.class, - Integer.class + Boolean.class, + Boolean.class ); - writeCameraAvStreamManagementMicrophoneMaxLevelCommandParams.put( + writeCameraAvStreamManagementMicrophoneAGCEnabledCommandParams.put( "value", - cameraAvStreamManagementmicrophoneMaxLevelCommandParameterInfo + cameraAvStreamManagementmicrophoneAGCEnabledCommandParameterInfo ); - InteractionInfo writeCameraAvStreamManagementMicrophoneMaxLevelAttributeInteractionInfo = new InteractionInfo( + InteractionInfo writeCameraAvStreamManagementMicrophoneAGCEnabledAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeMicrophoneMaxLevelAttribute( + ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeMicrophoneAGCEnabledAttribute( (DefaultClusterCallback) callback, - (Integer) commandArguments.get("value") + (Boolean) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementMicrophoneMaxLevelCommandParams + writeCameraAvStreamManagementMicrophoneAGCEnabledCommandParams ); - writeCameraAvStreamManagementInteractionInfo.put("writeMicrophoneMaxLevelAttribute", writeCameraAvStreamManagementMicrophoneMaxLevelAttributeInteractionInfo); - Map writeCameraAvStreamManagementMicrophoneMinLevelCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementmicrophoneMinLevelCommandParameterInfo = + writeCameraAvStreamManagementInteractionInfo.put("writeMicrophoneAGCEnabledAttribute", writeCameraAvStreamManagementMicrophoneAGCEnabledAttributeInteractionInfo); + Map writeCameraAvStreamManagementImageRotationCommandParams = new LinkedHashMap(); + CommandParameterInfo cameraAvStreamManagementimageRotationCommandParameterInfo = new CommandParameterInfo( "value", Integer.class, Integer.class ); - writeCameraAvStreamManagementMicrophoneMinLevelCommandParams.put( + writeCameraAvStreamManagementImageRotationCommandParams.put( "value", - cameraAvStreamManagementmicrophoneMinLevelCommandParameterInfo + cameraAvStreamManagementimageRotationCommandParameterInfo ); - InteractionInfo writeCameraAvStreamManagementMicrophoneMinLevelAttributeInteractionInfo = new InteractionInfo( + InteractionInfo writeCameraAvStreamManagementImageRotationAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeMicrophoneMinLevelAttribute( + ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeImageRotationAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementMicrophoneMinLevelCommandParams + writeCameraAvStreamManagementImageRotationCommandParams ); - writeCameraAvStreamManagementInteractionInfo.put("writeMicrophoneMinLevelAttribute", writeCameraAvStreamManagementMicrophoneMinLevelAttributeInteractionInfo); - Map writeCameraAvStreamManagementMicrophoneAGCEnabledCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementmicrophoneAGCEnabledCommandParameterInfo = + writeCameraAvStreamManagementInteractionInfo.put("writeImageRotationAttribute", writeCameraAvStreamManagementImageRotationAttributeInteractionInfo); + Map writeCameraAvStreamManagementImageFlipHorizontalCommandParams = new LinkedHashMap(); + CommandParameterInfo cameraAvStreamManagementimageFlipHorizontalCommandParameterInfo = new CommandParameterInfo( "value", Boolean.class, Boolean.class ); - writeCameraAvStreamManagementMicrophoneAGCEnabledCommandParams.put( + writeCameraAvStreamManagementImageFlipHorizontalCommandParams.put( "value", - cameraAvStreamManagementmicrophoneAGCEnabledCommandParameterInfo + cameraAvStreamManagementimageFlipHorizontalCommandParameterInfo ); - InteractionInfo writeCameraAvStreamManagementMicrophoneAGCEnabledAttributeInteractionInfo = new InteractionInfo( + InteractionInfo writeCameraAvStreamManagementImageFlipHorizontalAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeMicrophoneAGCEnabledAttribute( + ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeImageFlipHorizontalAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementMicrophoneAGCEnabledCommandParams + writeCameraAvStreamManagementImageFlipHorizontalCommandParams ); - writeCameraAvStreamManagementInteractionInfo.put("writeMicrophoneAGCEnabledAttribute", writeCameraAvStreamManagementMicrophoneAGCEnabledAttributeInteractionInfo); + writeCameraAvStreamManagementInteractionInfo.put("writeImageFlipHorizontalAttribute", writeCameraAvStreamManagementImageFlipHorizontalAttributeInteractionInfo); + Map writeCameraAvStreamManagementImageFlipVerticalCommandParams = new LinkedHashMap(); + CommandParameterInfo cameraAvStreamManagementimageFlipVerticalCommandParameterInfo = + new CommandParameterInfo( + "value", + Boolean.class, + Boolean.class + ); + writeCameraAvStreamManagementImageFlipVerticalCommandParams.put( + "value", + cameraAvStreamManagementimageFlipVerticalCommandParameterInfo + ); + InteractionInfo writeCameraAvStreamManagementImageFlipVerticalAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeImageFlipVerticalAttribute( + (DefaultClusterCallback) callback, + (Boolean) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeCameraAvStreamManagementImageFlipVerticalCommandParams + ); + writeCameraAvStreamManagementInteractionInfo.put("writeImageFlipVerticalAttribute", writeCameraAvStreamManagementImageFlipVerticalAttributeInteractionInfo); Map writeCameraAvStreamManagementLocalVideoRecordingEnabledCommandParams = new LinkedHashMap(); CommandParameterInfo cameraAvStreamManagementlocalVideoRecordingEnabledCommandParameterInfo = new CommandParameterInfo( @@ -3827,28 +3739,6 @@ public Map> getWriteAttributeMap() { writeCameraAvStreamManagementStatusLightBrightnessCommandParams ); writeCameraAvStreamManagementInteractionInfo.put("writeStatusLightBrightnessAttribute", writeCameraAvStreamManagementStatusLightBrightnessAttributeInteractionInfo); - Map writeCameraAvStreamManagementDepthSensorStatusCommandParams = new LinkedHashMap(); - CommandParameterInfo cameraAvStreamManagementdepthSensorStatusCommandParameterInfo = - new CommandParameterInfo( - "value", - Integer.class, - Integer.class - ); - writeCameraAvStreamManagementDepthSensorStatusCommandParams.put( - "value", - cameraAvStreamManagementdepthSensorStatusCommandParameterInfo - ); - InteractionInfo writeCameraAvStreamManagementDepthSensorStatusAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.CameraAvStreamManagementCluster) cluster).writeDepthSensorStatusAttribute( - (DefaultClusterCallback) callback, - (Integer) commandArguments.get("value") - ); - }, - () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeCameraAvStreamManagementDepthSensorStatusCommandParams - ); - writeCameraAvStreamManagementInteractionInfo.put("writeDepthSensorStatusAttribute", writeCameraAvStreamManagementDepthSensorStatusAttributeInteractionInfo); writeAttributeMap.put("cameraAvStreamManagement", writeCameraAvStreamManagementInteractionInfo); Map writeWebRTCTransportProviderInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("webRTCTransportProvider", writeWebRTCTransportProviderInteractionInfo); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 2aed70a3dc..a4fcda9f9b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -176,7 +176,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterTwoDCartesianVertexStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterTwoDCartesianZoneStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneInformationStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt", ] eventstructs_sources = [ diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt similarity index 74% rename from src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt rename to src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt index 3e55171ac8..76a8cbaf11 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt @@ -17,23 +17,26 @@ package chip.devicecontroller.cluster.structs import chip.devicecontroller.cluster.* +import java.util.Optional import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ZoneManagementClusterZoneTriggeringTimeControlStruct( +class ZoneManagementClusterZoneTriggerControlStruct( val initialDuration: UInt, val augmentationDuration: UInt, val maxDuration: ULong, val blindDuration: UInt, + val sensitivity: Optional, ) { override fun toString(): String = buildString { - append("ZoneManagementClusterZoneTriggeringTimeControlStruct {\n") + append("ZoneManagementClusterZoneTriggerControlStruct {\n") append("\tinitialDuration : $initialDuration\n") append("\taugmentationDuration : $augmentationDuration\n") append("\tmaxDuration : $maxDuration\n") append("\tblindDuration : $blindDuration\n") + append("\tsensitivity : $sensitivity\n") append("}\n") } @@ -44,6 +47,10 @@ class ZoneManagementClusterZoneTriggeringTimeControlStruct( put(ContextSpecificTag(TAG_AUGMENTATION_DURATION), augmentationDuration) put(ContextSpecificTag(TAG_MAX_DURATION), maxDuration) put(ContextSpecificTag(TAG_BLIND_DURATION), blindDuration) + if (sensitivity.isPresent) { + val optsensitivity = sensitivity.get() + put(ContextSpecificTag(TAG_SENSITIVITY), optsensitivity) + } endStructure() } } @@ -53,24 +60,29 @@ class ZoneManagementClusterZoneTriggeringTimeControlStruct( private const val TAG_AUGMENTATION_DURATION = 1 private const val TAG_MAX_DURATION = 2 private const val TAG_BLIND_DURATION = 3 + private const val TAG_SENSITIVITY = 4 - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader, - ): ZoneManagementClusterZoneTriggeringTimeControlStruct { + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ZoneManagementClusterZoneTriggerControlStruct { tlvReader.enterStructure(tlvTag) val initialDuration = tlvReader.getUInt(ContextSpecificTag(TAG_INITIAL_DURATION)) val augmentationDuration = tlvReader.getUInt(ContextSpecificTag(TAG_AUGMENTATION_DURATION)) val maxDuration = tlvReader.getULong(ContextSpecificTag(TAG_MAX_DURATION)) val blindDuration = tlvReader.getUInt(ContextSpecificTag(TAG_BLIND_DURATION)) + val sensitivity = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SENSITIVITY))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_SENSITIVITY))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return ZoneManagementClusterZoneTriggeringTimeControlStruct( + return ZoneManagementClusterZoneTriggerControlStruct( initialDuration, augmentationDuration, maxDuration, blindDuration, + sensitivity, ) } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvStreamManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvStreamManagementCluster.kt index c099340307..9a8e562d2f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvStreamManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/CameraAvStreamManagementCluster.kt @@ -656,93 +656,6 @@ class CameraAvStreamManagementCluster( logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun setViewport( - viewport: CameraAvStreamManagementClusterViewportStruct, - timedInvokeTimeout: Duration? = null, - ) { - val commandId: UInt = 13u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_VIEWPORT_REQ: Int = 0 - viewport.toTlv(ContextSpecificTag(TAG_VIEWPORT_REQ), tlvWriter) - tlvWriter.endStructure() - - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) - - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - - suspend fun setImageRotation(angle: UShort, timedInvokeTimeout: Duration? = null) { - val commandId: UInt = 14u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_ANGLE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ANGLE_REQ), angle) - tlvWriter.endStructure() - - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) - - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - - suspend fun setImageFlipHorizontal(enabled: Boolean, timedInvokeTimeout: Duration? = null) { - val commandId: UInt = 15u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_ENABLED_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ENABLED_REQ), enabled) - tlvWriter.endStructure() - - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) - - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - - suspend fun setImageFlipVertical(enabled: Boolean, timedInvokeTimeout: Duration? = null) { - val commandId: UInt = 16u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_ENABLED_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ENABLED_REQ), enabled) - tlvWriter.endStructure() - - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) - - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - suspend fun readMaxConcurrentVideoEncodersAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 0u @@ -3543,7 +3456,7 @@ class CameraAvStreamManagementCluster( } } - suspend fun readAWBEnabledAttribute(): Boolean? { + suspend fun readViewportAttribute(): ViewportAttribute { val ATTRIBUTE_ID: UInt = 26u val attributePath = @@ -3565,25 +3478,28 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Awbenabled attribute not found in response" } + requireNotNull(attributeData) { "Viewport attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = + val decodedValue: CameraAvStreamManagementClusterViewportStruct? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) + CameraAvStreamManagementClusterViewportStruct.fromTlv(AnonymousTag, tlvReader) } else { null } - return decodedValue + return ViewportAttribute(decodedValue) } - suspend fun writeAWBEnabledAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { + suspend fun writeViewportAttribute( + value: CameraAvStreamManagementClusterViewportStruct, + timedWriteTimeout: Duration? = null, + ) { val ATTRIBUTE_ID: UInt = 26u val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) + value.toTlv(AnonymousTag, tlvWriter) val writeRequests: WriteRequests = WriteRequests( @@ -3619,10 +3535,10 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeAWBEnabledAttribute( + suspend fun subscribeViewportAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 26u val attributePaths = listOf( @@ -3641,7 +3557,7 @@ class CameraAvStreamManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - BooleanSubscriptionState.Error( + ViewportAttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -3654,27 +3570,27 @@ class CameraAvStreamManagementCluster( .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Awbenabled attribute not found in Node State update" } + requireNotNull(attributeData) { "Viewport attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = + val decodedValue: CameraAvStreamManagementClusterViewportStruct? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) + CameraAvStreamManagementClusterViewportStruct.fromTlv(AnonymousTag, tlvReader) } else { null } - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } + decodedValue?.let { emit(ViewportAttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) + emit(ViewportAttributeSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readAutoShutterSpeedEnabledAttribute(): Boolean? { + suspend fun readSpeakerMutedAttribute(): Boolean? { val ATTRIBUTE_ID: UInt = 27u val attributePath = @@ -3696,7 +3612,7 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Autoshutterspeedenabled attribute not found in response" } + requireNotNull(attributeData) { "Speakermuted attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -3710,10 +3626,7 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeAutoShutterSpeedEnabledAttribute( - value: Boolean, - timedWriteTimeout: Duration? = null, - ) { + suspend fun writeSpeakerMutedAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { val ATTRIBUTE_ID: UInt = 27u val tlvWriter = TlvWriter() @@ -3753,7 +3666,7 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeAutoShutterSpeedEnabledAttribute( + suspend fun subscribeSpeakerMutedAttribute( minInterval: Int, maxInterval: Int, ): Flow { @@ -3788,9 +3701,7 @@ class CameraAvStreamManagementCluster( .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { - "Autoshutterspeedenabled attribute not found in Node State update" - } + requireNotNull(attributeData) { "Speakermuted attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -3810,7 +3721,7 @@ class CameraAvStreamManagementCluster( } } - suspend fun readAutoISOEnabledAttribute(): Boolean? { + suspend fun readSpeakerVolumeLevelAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 28u val attributePath = @@ -3832,13 +3743,13 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Autoisoenabled attribute not found in response" } + requireNotNull(attributeData) { "Speakervolumelevel attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = + val decodedValue: UByte? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) + tlvReader.getUByte(AnonymousTag) } else { null } @@ -3846,7 +3757,7 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeAutoISOEnabledAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { + suspend fun writeSpeakerVolumeLevelAttribute(value: UByte, timedWriteTimeout: Duration? = null) { val ATTRIBUTE_ID: UInt = 28u val tlvWriter = TlvWriter() @@ -3886,10 +3797,10 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeAutoISOEnabledAttribute( + suspend fun subscribeSpeakerVolumeLevelAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 28u val attributePaths = listOf( @@ -3908,7 +3819,7 @@ class CameraAvStreamManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - BooleanSubscriptionState.Error( + UByteSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -3922,28 +3833,28 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Autoisoenabled attribute not found in Node State update" + "Speakervolumelevel attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = + val decodedValue: UByte? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) + tlvReader.getUByte(AnonymousTag) } else { null } - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) + emit(UByteSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readViewportAttribute(): ViewportAttribute { + suspend fun readSpeakerMaxLevelAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 29u val attributePath = @@ -3965,24 +3876,24 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Viewport attribute not found in response" } + requireNotNull(attributeData) { "Speakermaxlevel attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: CameraAvStreamManagementClusterViewportStruct? = + val decodedValue: UByte? = if (tlvReader.isNextTag(AnonymousTag)) { - CameraAvStreamManagementClusterViewportStruct.fromTlv(AnonymousTag, tlvReader) + tlvReader.getUByte(AnonymousTag) } else { null } - return ViewportAttribute(decodedValue) + return decodedValue } - suspend fun subscribeViewportAttribute( + suspend fun subscribeSpeakerMaxLevelAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 29u val attributePaths = listOf( @@ -4001,7 +3912,7 @@ class CameraAvStreamManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - ViewportAttributeSubscriptionState.Error( + UByteSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -4014,27 +3925,29 @@ class CameraAvStreamManagementCluster( .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Viewport attribute not found in Node State update" } + requireNotNull(attributeData) { + "Speakermaxlevel attribute not found in Node State update" + } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: CameraAvStreamManagementClusterViewportStruct? = + val decodedValue: UByte? = if (tlvReader.isNextTag(AnonymousTag)) { - CameraAvStreamManagementClusterViewportStruct.fromTlv(AnonymousTag, tlvReader) + tlvReader.getUByte(AnonymousTag) } else { null } - decodedValue?.let { emit(ViewportAttributeSubscriptionState.Success(it)) } + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(ViewportAttributeSubscriptionState.SubscriptionEstablished) + emit(UByteSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readSpeakerMutedAttribute(): Boolean? { + suspend fun readSpeakerMinLevelAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 30u val attributePath = @@ -4056,13 +3969,13 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Speakermuted attribute not found in response" } + requireNotNull(attributeData) { "Speakerminlevel attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = + val decodedValue: UByte? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) + tlvReader.getUByte(AnonymousTag) } else { null } @@ -4070,50 +3983,10 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeSpeakerMutedAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 30u - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded(), - ) - ), - timedRequest = timedWriteTimeout, - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - - suspend fun subscribeSpeakerMutedAttribute( + suspend fun subscribeSpeakerMinLevelAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 30u val attributePaths = listOf( @@ -4132,7 +4005,7 @@ class CameraAvStreamManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - BooleanSubscriptionState.Error( + UByteSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -4145,27 +4018,29 @@ class CameraAvStreamManagementCluster( .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Speakermuted attribute not found in Node State update" } + requireNotNull(attributeData) { + "Speakerminlevel attribute not found in Node State update" + } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = + val decodedValue: UByte? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) + tlvReader.getUByte(AnonymousTag) } else { null } - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) + emit(UByteSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readSpeakerVolumeLevelAttribute(): UByte? { + suspend fun readMicrophoneMutedAttribute(): Boolean? { val ATTRIBUTE_ID: UInt = 31u val attributePath = @@ -4187,13 +4062,13 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Speakervolumelevel attribute not found in response" } + requireNotNull(attributeData) { "Microphonemuted attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = + val decodedValue: Boolean? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) + tlvReader.getBoolean(AnonymousTag) } else { null } @@ -4201,7 +4076,7 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeSpeakerVolumeLevelAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + suspend fun writeMicrophoneMutedAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { val ATTRIBUTE_ID: UInt = 31u val tlvWriter = TlvWriter() @@ -4241,10 +4116,10 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeSpeakerVolumeLevelAttribute( + suspend fun subscribeMicrophoneMutedAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 31u val attributePaths = listOf( @@ -4263,7 +4138,7 @@ class CameraAvStreamManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - UByteSubscriptionState.Error( + BooleanSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -4277,28 +4152,28 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Speakervolumelevel attribute not found in Node State update" + "Microphonemuted attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = + val decodedValue: Boolean? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) + tlvReader.getBoolean(AnonymousTag) } else { null } - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } + decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) + emit(BooleanSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readSpeakerMaxLevelAttribute(): UByte? { + suspend fun readMicrophoneVolumeLevelAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 32u val attributePath = @@ -4320,7 +4195,7 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Speakermaxlevel attribute not found in response" } + requireNotNull(attributeData) { "Microphonevolumelevel attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -4334,7 +4209,10 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeSpeakerMaxLevelAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + suspend fun writeMicrophoneVolumeLevelAttribute( + value: UByte, + timedWriteTimeout: Duration? = null, + ) { val ATTRIBUTE_ID: UInt = 32u val tlvWriter = TlvWriter() @@ -4374,7 +4252,7 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeSpeakerMaxLevelAttribute( + suspend fun subscribeMicrophoneVolumeLevelAttribute( minInterval: Int, maxInterval: Int, ): Flow { @@ -4392,408 +4270,6 @@ class CameraAvStreamManagementCluster( maxInterval = Duration.ofSeconds(maxInterval.toLong()), ) - return controller.subscribe(subscribeRequest).transform { subscriptionState -> - when (subscriptionState) { - is SubscriptionState.SubscriptionErrorNotification -> { - emit( - UByteSubscriptionState.Error( - Exception( - "Subscription terminated with error code: ${subscriptionState.terminationCause}" - ) - ) - ) - } - is SubscriptionState.NodeStateUpdate -> { - val attributeData = - subscriptionState.updateState.successes - .filterIsInstance() - .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - - requireNotNull(attributeData) { - "Speakermaxlevel attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) - } - } - } - } - - suspend fun readSpeakerMinLevelAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 33u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Speakerminlevel attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun writeSpeakerMinLevelAttribute(value: UByte, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 33u - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded(), - ) - ), - timedRequest = timedWriteTimeout, - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - - suspend fun subscribeSpeakerMinLevelAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 33u - val attributePaths = - listOf( - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - ) - - val subscribeRequest: SubscribeRequest = - SubscribeRequest( - eventPaths = emptyList(), - attributePaths = attributePaths, - minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()), - ) - - return controller.subscribe(subscribeRequest).transform { subscriptionState -> - when (subscriptionState) { - is SubscriptionState.SubscriptionErrorNotification -> { - emit( - UByteSubscriptionState.Error( - Exception( - "Subscription terminated with error code: ${subscriptionState.terminationCause}" - ) - ) - ) - } - is SubscriptionState.NodeStateUpdate -> { - val attributeData = - subscriptionState.updateState.successes - .filterIsInstance() - .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - - requireNotNull(attributeData) { - "Speakerminlevel attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) - } - } - } - } - - suspend fun readMicrophoneMutedAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 34u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Microphonemuted attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun writeMicrophoneMutedAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 34u - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded(), - ) - ), - timedRequest = timedWriteTimeout, - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - - suspend fun subscribeMicrophoneMutedAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 34u - val attributePaths = - listOf( - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - ) - - val subscribeRequest: SubscribeRequest = - SubscribeRequest( - eventPaths = emptyList(), - attributePaths = attributePaths, - minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()), - ) - - return controller.subscribe(subscribeRequest).transform { subscriptionState -> - when (subscriptionState) { - is SubscriptionState.SubscriptionErrorNotification -> { - emit( - BooleanSubscriptionState.Error( - Exception( - "Subscription terminated with error code: ${subscriptionState.terminationCause}" - ) - ) - ) - } - is SubscriptionState.NodeStateUpdate -> { - val attributeData = - subscriptionState.updateState.successes - .filterIsInstance() - .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - - requireNotNull(attributeData) { - "Microphonemuted attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) - } - } - } - } - - suspend fun readMicrophoneVolumeLevelAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 35u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Microphonevolumelevel attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun writeMicrophoneVolumeLevelAttribute( - value: UByte, - timedWriteTimeout: Duration? = null, - ) { - val ATTRIBUTE_ID: UInt = 35u - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded(), - ) - ), - timedRequest = timedWriteTimeout, - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - - suspend fun subscribeMicrophoneVolumeLevelAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 35u - val attributePaths = - listOf( - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - ) - - val subscribeRequest: SubscribeRequest = - SubscribeRequest( - eventPaths = emptyList(), - attributePaths = attributePaths, - minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()), - ) - return controller.subscribe(subscribeRequest).transform { subscriptionState -> when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { @@ -4834,7 +4310,7 @@ class CameraAvStreamManagementCluster( } suspend fun readMicrophoneMaxLevelAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 36u + val ATTRIBUTE_ID: UInt = 33u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -4869,51 +4345,11 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeMicrophoneMaxLevelAttribute(value: UByte, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 36u - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded(), - ) - ), - timedRequest = timedWriteTimeout, - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - suspend fun subscribeMicrophoneMaxLevelAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 36u + val ATTRIBUTE_ID: UInt = 33u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -4967,7 +4403,7 @@ class CameraAvStreamManagementCluster( } suspend fun readMicrophoneMinLevelAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 37u + val ATTRIBUTE_ID: UInt = 34u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5002,51 +4438,11 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeMicrophoneMinLevelAttribute(value: UByte, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 37u - - val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) - - val writeRequests: WriteRequests = - WriteRequests( - requests = - listOf( - WriteRequest( - attributePath = - AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), - tlvPayload = tlvWriter.getEncoded(), - ) - ), - timedRequest = timedWriteTimeout, - ) - - val response: WriteResponse = controller.write(writeRequests) - - when (response) { - is WriteResponse.Success -> { - logger.log(Level.FINE, "Write command succeeded") - } - is WriteResponse.PartialWriteFailure -> { - val aggregatedErrorMessage = - response.failures.joinToString("\n") { failure -> - "Error at ${failure.attributePath}: ${failure.ex.message}" - } - - response.failures.forEach { failure -> - logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") - } - - throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") - } - } - } - suspend fun subscribeMicrophoneMinLevelAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 37u + val ATTRIBUTE_ID: UInt = 34u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5100,7 +4496,7 @@ class CameraAvStreamManagementCluster( } suspend fun readMicrophoneAGCEnabledAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 38u + val ATTRIBUTE_ID: UInt = 35u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5139,7 +4535,7 @@ class CameraAvStreamManagementCluster( value: Boolean, timedWriteTimeout: Duration? = null, ) { - val ATTRIBUTE_ID: UInt = 38u + val ATTRIBUTE_ID: UInt = 35u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -5182,7 +4578,7 @@ class CameraAvStreamManagementCluster( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 38u + val ATTRIBUTE_ID: UInt = 35u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5236,7 +4632,7 @@ class CameraAvStreamManagementCluster( } suspend fun readImageRotationAttribute(): UShort? { - val ATTRIBUTE_ID: UInt = 39u + val ATTRIBUTE_ID: UInt = 36u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5271,11 +4667,51 @@ class CameraAvStreamManagementCluster( return decodedValue } + suspend fun writeImageRotationAttribute(value: UShort, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 36u + + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), + ) + ), + timedRequest = timedWriteTimeout, + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + suspend fun subscribeImageRotationAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 39u + val ATTRIBUTE_ID: UInt = 36u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5327,7 +4763,7 @@ class CameraAvStreamManagementCluster( } suspend fun readImageFlipHorizontalAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 40u + val ATTRIBUTE_ID: UInt = 37u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5362,104 +4798,54 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun subscribeImageFlipHorizontalAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 40u - val attributePaths = - listOf( - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - ) + suspend fun writeImageFlipHorizontalAttribute( + value: Boolean, + timedWriteTimeout: Duration? = null, + ) { + val ATTRIBUTE_ID: UInt = 37u - val subscribeRequest: SubscribeRequest = - SubscribeRequest( - eventPaths = emptyList(), - attributePaths = attributePaths, - minInterval = Duration.ofSeconds(minInterval.toLong()), - maxInterval = Duration.ofSeconds(maxInterval.toLong()), - ) + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) - return controller.subscribe(subscribeRequest).transform { subscriptionState -> - when (subscriptionState) { - is SubscriptionState.SubscriptionErrorNotification -> { - emit( - BooleanSubscriptionState.Error( - Exception( - "Subscription terminated with error code: ${subscriptionState.terminationCause}" - ) + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), ) - ) - } - is SubscriptionState.NodeStateUpdate -> { - val attributeData = - subscriptionState.updateState.successes - .filterIsInstance() - .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - - requireNotNull(attributeData) { - "Imagefliphorizontal attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) - } - } - } - } - - suspend fun readImageFlipVerticalAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 41u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } + ), + timedRequest = timedWriteTimeout, + ) - logger.log(Level.FINE, "Read command succeeded") + val response: WriteResponse = controller.write(writeRequests) - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } - requireNotNull(attributeData) { "Imageflipvertical attribute not found in response" } + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") } - - return decodedValue + } } - suspend fun subscribeImageFlipVerticalAttribute( + suspend fun subscribeImageFlipHorizontalAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 41u + val ATTRIBUTE_ID: UInt = 37u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5491,7 +4877,7 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Imageflipvertical attribute not found in Node State update" + "Imagefliphorizontal attribute not found in Node State update" } // Decode the TLV data into the appropriate type @@ -5512,8 +4898,8 @@ class CameraAvStreamManagementCluster( } } - suspend fun readLocalVideoRecordingEnabledAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 42u + suspend fun readImageFlipVerticalAttribute(): Boolean? { + val ATTRIBUTE_ID: UInt = 38u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5534,7 +4920,7 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Localvideorecordingenabled attribute not found in response" } + requireNotNull(attributeData) { "Imageflipvertical attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -5548,11 +4934,8 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeLocalVideoRecordingEnabledAttribute( - value: Boolean, - timedWriteTimeout: Duration? = null, - ) { - val ATTRIBUTE_ID: UInt = 42u + suspend fun writeImageFlipVerticalAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 38u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -5591,11 +4974,11 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeLocalVideoRecordingEnabledAttribute( + suspend fun subscribeImageFlipVerticalAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 42u + val ATTRIBUTE_ID: UInt = 38u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5627,7 +5010,7 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Localvideorecordingenabled attribute not found in Node State update" + "Imageflipvertical attribute not found in Node State update" } // Decode the TLV data into the appropriate type @@ -5648,8 +5031,8 @@ class CameraAvStreamManagementCluster( } } - suspend fun readLocalSnapshotRecordingEnabledAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 43u + suspend fun readLocalVideoRecordingEnabledAttribute(): Boolean? { + val ATTRIBUTE_ID: UInt = 39u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5670,9 +5053,7 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { - "Localsnapshotrecordingenabled attribute not found in response" - } + requireNotNull(attributeData) { "Localvideorecordingenabled attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -5686,11 +5067,11 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeLocalSnapshotRecordingEnabledAttribute( + suspend fun writeLocalVideoRecordingEnabledAttribute( value: Boolean, timedWriteTimeout: Duration? = null, ) { - val ATTRIBUTE_ID: UInt = 43u + val ATTRIBUTE_ID: UInt = 39u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -5729,11 +5110,11 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeLocalSnapshotRecordingEnabledAttribute( + suspend fun subscribeLocalVideoRecordingEnabledAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 43u + val ATTRIBUTE_ID: UInt = 39u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5765,7 +5146,7 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Localsnapshotrecordingenabled attribute not found in Node State update" + "Localvideorecordingenabled attribute not found in Node State update" } // Decode the TLV data into the appropriate type @@ -5786,8 +5167,8 @@ class CameraAvStreamManagementCluster( } } - suspend fun readStatusLightEnabledAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 44u + suspend fun readLocalSnapshotRecordingEnabledAttribute(): Boolean? { + val ATTRIBUTE_ID: UInt = 40u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5808,7 +5189,9 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Statuslightenabled attribute not found in response" } + requireNotNull(attributeData) { + "Localsnapshotrecordingenabled attribute not found in response" + } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -5822,11 +5205,11 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeStatusLightEnabledAttribute( + suspend fun writeLocalSnapshotRecordingEnabledAttribute( value: Boolean, timedWriteTimeout: Duration? = null, ) { - val ATTRIBUTE_ID: UInt = 44u + val ATTRIBUTE_ID: UInt = 40u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -5865,11 +5248,11 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeStatusLightEnabledAttribute( + suspend fun subscribeLocalSnapshotRecordingEnabledAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 44u + val ATTRIBUTE_ID: UInt = 40u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5901,7 +5284,7 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Statuslightenabled attribute not found in Node State update" + "Localsnapshotrecordingenabled attribute not found in Node State update" } // Decode the TLV data into the appropriate type @@ -5922,8 +5305,8 @@ class CameraAvStreamManagementCluster( } } - suspend fun readStatusLightBrightnessAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 45u + suspend fun readStatusLightEnabledAttribute(): Boolean? { + val ATTRIBUTE_ID: UInt = 41u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -5944,13 +5327,13 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Statuslightbrightness attribute not found in response" } + requireNotNull(attributeData) { "Statuslightenabled attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = + val decodedValue: Boolean? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) + tlvReader.getBoolean(AnonymousTag) } else { null } @@ -5958,11 +5341,11 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeStatusLightBrightnessAttribute( - value: UByte, + suspend fun writeStatusLightEnabledAttribute( + value: Boolean, timedWriteTimeout: Duration? = null, ) { - val ATTRIBUTE_ID: UInt = 45u + val ATTRIBUTE_ID: UInt = 41u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -6001,11 +5384,11 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeStatusLightBrightnessAttribute( + suspend fun subscribeStatusLightEnabledAttribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 45u + ): Flow { + val ATTRIBUTE_ID: UInt = 41u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -6023,7 +5406,7 @@ class CameraAvStreamManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - UByteSubscriptionState.Error( + BooleanSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -6037,29 +5420,29 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Statuslightbrightness attribute not found in Node State update" + "Statuslightenabled attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = + val decodedValue: Boolean? = if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) + tlvReader.getBoolean(AnonymousTag) } else { null } - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } + decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) + emit(BooleanSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readDepthSensorStatusAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 46u + suspend fun readStatusLightBrightnessAttribute(): UByte? { + val ATTRIBUTE_ID: UInt = 42u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -6080,7 +5463,7 @@ class CameraAvStreamManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Depthsensorstatus attribute not found in response" } + requireNotNull(attributeData) { "Statuslightbrightness attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) @@ -6094,8 +5477,11 @@ class CameraAvStreamManagementCluster( return decodedValue } - suspend fun writeDepthSensorStatusAttribute(value: UByte, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 46u + suspend fun writeStatusLightBrightnessAttribute( + value: UByte, + timedWriteTimeout: Duration? = null, + ) { + val ATTRIBUTE_ID: UInt = 42u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -6134,11 +5520,11 @@ class CameraAvStreamManagementCluster( } } - suspend fun subscribeDepthSensorStatusAttribute( + suspend fun subscribeStatusLightBrightnessAttribute( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 46u + val ATTRIBUTE_ID: UInt = 42u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -6170,7 +5556,7 @@ class CameraAvStreamManagementCluster( .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Depthsensorstatus attribute not found in Node State update" + "Statuslightbrightness attribute not found in Node State update" } // Decode the TLV data into the appropriate type diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ZoneManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ZoneManagementCluster.kt index c51fe6eaf0..9a85fdba03 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ZoneManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ZoneManagementCluster.kt @@ -72,15 +72,15 @@ class ZoneManagementCluster( object SubscriptionEstablished : ZonesAttributeSubscriptionState() } - class TimeControlAttribute(val value: List) + class TriggersAttribute(val value: List) - sealed class TimeControlAttributeSubscriptionState { - data class Success(val value: List) : - TimeControlAttributeSubscriptionState() + sealed class TriggersAttributeSubscriptionState { + data class Success(val value: List) : + TriggersAttributeSubscriptionState() - data class Error(val exception: Exception) : TimeControlAttributeSubscriptionState() + data class Error(val exception: Exception) : TriggersAttributeSubscriptionState() - object SubscriptionEstablished : TimeControlAttributeSubscriptionState() + object SubscriptionEstablished : TriggersAttributeSubscriptionState() } class GeneratedCommandListAttribute(val value: List) @@ -473,7 +473,7 @@ class ZoneManagementCluster( } } - suspend fun readTimeControlAttribute(): TimeControlAttribute { + suspend fun readTriggersAttribute(): TriggersAttribute { val ATTRIBUTE_ID: UInt = 2u val attributePath = @@ -495,24 +495,24 @@ class ZoneManagementCluster( it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Timecontrol attribute not found in response" } + requireNotNull(attributeData) { "Triggers attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { + val decodedValue: List = + buildList { tlvReader.enterArray(AnonymousTag) while (!tlvReader.isEndOfContainer()) { - add(ZoneManagementClusterZoneTriggeringTimeControlStruct.fromTlv(AnonymousTag, tlvReader)) + add(ZoneManagementClusterZoneTriggerControlStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } - return TimeControlAttribute(decodedValue) + return TriggersAttribute(decodedValue) } - suspend fun writeTimeControlAttribute( - value: List, + suspend fun writeTriggersAttribute( + value: List, timedWriteTimeout: Duration? = null, ) { val ATTRIBUTE_ID: UInt = 2u @@ -558,10 +558,10 @@ class ZoneManagementCluster( } } - suspend fun subscribeTimeControlAttribute( + suspend fun subscribeTriggersAttribute( minInterval: Int, maxInterval: Int, - ): Flow { + ): Flow { val ATTRIBUTE_ID: UInt = 2u val attributePaths = listOf( @@ -580,7 +580,7 @@ class ZoneManagementCluster( when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - TimeControlAttributeSubscriptionState.Error( + TriggersAttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -593,34 +593,29 @@ class ZoneManagementCluster( .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Timecontrol attribute not found in Node State update" } + requireNotNull(attributeData) { "Triggers attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { + val decodedValue: List = + buildList { tlvReader.enterArray(AnonymousTag) while (!tlvReader.isEndOfContainer()) { - add( - ZoneManagementClusterZoneTriggeringTimeControlStruct.fromTlv( - AnonymousTag, - tlvReader, - ) - ) + add(ZoneManagementClusterZoneTriggerControlStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } - emit(TimeControlAttributeSubscriptionState.Success(decodedValue)) + emit(TriggersAttributeSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { - emit(TimeControlAttributeSubscriptionState.SubscriptionEstablished) + emit(TriggersAttributeSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readSensitivityAttribute(): UByte { + suspend fun readSensitivityAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 3u val attributePath = @@ -646,7 +641,12 @@ class ZoneManagementCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } return decodedValue } @@ -730,9 +730,14 @@ class ZoneManagementCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + val decodedValue: UByte? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } - emit(UByteSubscriptionState.Success(decodedValue)) + decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { emit(UByteSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 15406011f7..b09fc7b799 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -176,7 +176,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterTwoDCartesianVertexStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterTwoDCartesianZoneStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneInformationStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt", ] matter_eventstructs_sources = [ diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt similarity index 74% rename from src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt rename to src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt index 8978d74256..0927427722 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt @@ -16,24 +16,27 @@ */ package matter.controller.cluster.structs +import java.util.Optional import matter.controller.cluster.* import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ZoneManagementClusterZoneTriggeringTimeControlStruct( +class ZoneManagementClusterZoneTriggerControlStruct( val initialDuration: UShort, val augmentationDuration: UShort, val maxDuration: UInt, val blindDuration: UShort, + val sensitivity: Optional, ) { override fun toString(): String = buildString { - append("ZoneManagementClusterZoneTriggeringTimeControlStruct {\n") + append("ZoneManagementClusterZoneTriggerControlStruct {\n") append("\tinitialDuration : $initialDuration\n") append("\taugmentationDuration : $augmentationDuration\n") append("\tmaxDuration : $maxDuration\n") append("\tblindDuration : $blindDuration\n") + append("\tsensitivity : $sensitivity\n") append("}\n") } @@ -44,6 +47,10 @@ class ZoneManagementClusterZoneTriggeringTimeControlStruct( put(ContextSpecificTag(TAG_AUGMENTATION_DURATION), augmentationDuration) put(ContextSpecificTag(TAG_MAX_DURATION), maxDuration) put(ContextSpecificTag(TAG_BLIND_DURATION), blindDuration) + if (sensitivity.isPresent) { + val optsensitivity = sensitivity.get() + put(ContextSpecificTag(TAG_SENSITIVITY), optsensitivity) + } endStructure() } } @@ -53,24 +60,29 @@ class ZoneManagementClusterZoneTriggeringTimeControlStruct( private const val TAG_AUGMENTATION_DURATION = 1 private const val TAG_MAX_DURATION = 2 private const val TAG_BLIND_DURATION = 3 + private const val TAG_SENSITIVITY = 4 - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader, - ): ZoneManagementClusterZoneTriggeringTimeControlStruct { + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ZoneManagementClusterZoneTriggerControlStruct { tlvReader.enterStructure(tlvTag) val initialDuration = tlvReader.getUShort(ContextSpecificTag(TAG_INITIAL_DURATION)) val augmentationDuration = tlvReader.getUShort(ContextSpecificTag(TAG_AUGMENTATION_DURATION)) val maxDuration = tlvReader.getUInt(ContextSpecificTag(TAG_MAX_DURATION)) val blindDuration = tlvReader.getUShort(ContextSpecificTag(TAG_BLIND_DURATION)) + val sensitivity = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SENSITIVITY))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_SENSITIVITY))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return ZoneManagementClusterZoneTriggeringTimeControlStruct( + return ZoneManagementClusterZoneTriggerControlStruct( initialDuration, augmentationDuration, maxDuration, blindDuration, + sensitivity, ) } } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index c8247c5d4d..d307822772 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -39628,8 +39628,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::TimeControl::Id: { - using TypeInfo = Attributes::TimeControl::TypeInfo; + case Attributes::Triggers::Id: { + using TypeInfo = Attributes::Triggers::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -39672,34 +39672,50 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR chip::JniReferences::GetInstance().CreateBoxedObject( newElement_0_blindDurationClassName.c_str(), newElement_0_blindDurationCtorSignature.c_str(), jninewElement_0_blindDuration, newElement_0_blindDuration); + jobject newElement_0_sensitivity; + if (!entry_0.sensitivity.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_sensitivity); + } + else + { + jobject newElement_0_sensitivityInsideOptional; + std::string newElement_0_sensitivityInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_sensitivityInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_sensitivityInsideOptional = static_cast(entry_0.sensitivity.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_sensitivityInsideOptionalClassName.c_str(), + newElement_0_sensitivityInsideOptionalCtorSignature.c_str(), jninewElement_0_sensitivityInsideOptional, + newElement_0_sensitivityInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_sensitivityInsideOptional, + newElement_0_sensitivity); + } { - jclass zoneTriggeringTimeControlStructStructClass_1; + jclass zoneTriggerControlStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$ZoneManagementClusterZoneTriggeringTimeControlStruct", - zoneTriggeringTimeControlStructStructClass_1); + env, "chip/devicecontroller/ChipStructs$ZoneManagementClusterZoneTriggerControlStruct", + zoneTriggerControlStructStructClass_1); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$ZoneManagementClusterZoneTriggeringTimeControlStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$ZoneManagementClusterZoneTriggerControlStruct"); return nullptr; } - jmethodID zoneTriggeringTimeControlStructStructCtor_1; + jmethodID zoneTriggerControlStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod( - env, zoneTriggeringTimeControlStructStructClass_1, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Integer;)V", - &zoneTriggeringTimeControlStructStructCtor_1); - if (err != CHIP_NO_ERROR || zoneTriggeringTimeControlStructStructCtor_1 == nullptr) + env, zoneTriggerControlStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Integer;Ljava/util/Optional;)V", + &zoneTriggerControlStructStructCtor_1); + if (err != CHIP_NO_ERROR || zoneTriggerControlStructStructCtor_1 == nullptr) { - ChipLogError(Zcl, - "Could not find ChipStructs$ZoneManagementClusterZoneTriggeringTimeControlStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$ZoneManagementClusterZoneTriggerControlStruct constructor"); return nullptr; } - newElement_0 = - env->NewObject(zoneTriggeringTimeControlStructStructClass_1, zoneTriggeringTimeControlStructStructCtor_1, - newElement_0_initialDuration, newElement_0_augmentationDuration, newElement_0_maxDuration, - newElement_0_blindDuration); + newElement_0 = env->NewObject(zoneTriggerControlStructStructClass_1, zoneTriggerControlStructStructCtor_1, + newElement_0_initialDuration, newElement_0_augmentationDuration, + newElement_0_maxDuration, newElement_0_blindDuration, newElement_0_sensitivity); } chip::JniReferences::GetInstance().AddToList(value, newElement_0); } @@ -41252,54 +41268,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } - case Attributes::AWBEnabled::Id: { - using TypeInfo = Attributes::AWBEnabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Boolean"; - std::string valueCtorSignature = "(Z)V"; - jboolean jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); - return value; - } - case Attributes::AutoShutterSpeedEnabled::Id: { - using TypeInfo = Attributes::AutoShutterSpeedEnabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Boolean"; - std::string valueCtorSignature = "(Z)V"; - jboolean jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); - return value; - } - case Attributes::AutoISOEnabled::Id: { - using TypeInfo = Attributes::AutoISOEnabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Boolean"; - std::string valueCtorSignature = "(Z)V"; - jboolean jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); - return value; - } case Attributes::Viewport::Id: { using TypeInfo = Attributes::Viewport::TypeInfo; TypeInfo::DecodableType cppValue; @@ -41616,22 +41584,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } - case Attributes::DepthSensorStatus::Id: { - using TypeInfo = Attributes::DepthSensorStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Integer"; - std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, - value); - return value; - } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 08f8182e6b..ac906271d3 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -12339,7 +12339,7 @@ class ChipClusters: "reportable": True, }, 0x00000002: { - "attributeName": "TimeControl", + "attributeName": "Triggers", "attributeId": 0x00000002, "type": "", "reportable": True, @@ -12476,34 +12476,6 @@ class ChipClusters: "requestedResolution": "VideoResolutionStruct", }, }, - 0x0000000D: { - "commandId": 0x0000000D, - "commandName": "SetViewport", - "args": { - "viewport": "ViewportStruct", - }, - }, - 0x0000000E: { - "commandId": 0x0000000E, - "commandName": "SetImageRotation", - "args": { - "angle": "int", - }, - }, - 0x0000000F: { - "commandId": 0x0000000F, - "commandName": "SetImageFlipHorizontal", - "args": { - "enabled": "bool", - }, - }, - 0x00000010: { - "commandId": 0x00000010, - "commandName": "SetImageFlipVertical", - "args": { - "enabled": "bool", - }, - }, }, "attributes": { 0x00000000: { @@ -12669,144 +12641,116 @@ class ChipClusters: "writable": True, }, 0x0000001A: { - "attributeName": "AWBEnabled", + "attributeName": "Viewport", "attributeId": 0x0000001A, - "type": "bool", + "type": "", "reportable": True, "writable": True, }, 0x0000001B: { - "attributeName": "AutoShutterSpeedEnabled", + "attributeName": "SpeakerMuted", "attributeId": 0x0000001B, "type": "bool", "reportable": True, "writable": True, }, 0x0000001C: { - "attributeName": "AutoISOEnabled", + "attributeName": "SpeakerVolumeLevel", "attributeId": 0x0000001C, - "type": "bool", + "type": "int", "reportable": True, "writable": True, }, 0x0000001D: { - "attributeName": "Viewport", + "attributeName": "SpeakerMaxLevel", "attributeId": 0x0000001D, - "type": "", + "type": "int", "reportable": True, }, 0x0000001E: { - "attributeName": "SpeakerMuted", + "attributeName": "SpeakerMinLevel", "attributeId": 0x0000001E, - "type": "bool", + "type": "int", "reportable": True, - "writable": True, }, 0x0000001F: { - "attributeName": "SpeakerVolumeLevel", + "attributeName": "MicrophoneMuted", "attributeId": 0x0000001F, - "type": "int", + "type": "bool", "reportable": True, "writable": True, }, 0x00000020: { - "attributeName": "SpeakerMaxLevel", + "attributeName": "MicrophoneVolumeLevel", "attributeId": 0x00000020, "type": "int", "reportable": True, "writable": True, }, 0x00000021: { - "attributeName": "SpeakerMinLevel", + "attributeName": "MicrophoneMaxLevel", "attributeId": 0x00000021, "type": "int", "reportable": True, - "writable": True, }, 0x00000022: { - "attributeName": "MicrophoneMuted", + "attributeName": "MicrophoneMinLevel", "attributeId": 0x00000022, - "type": "bool", + "type": "int", "reportable": True, - "writable": True, }, 0x00000023: { - "attributeName": "MicrophoneVolumeLevel", + "attributeName": "MicrophoneAGCEnabled", "attributeId": 0x00000023, - "type": "int", + "type": "bool", "reportable": True, "writable": True, }, 0x00000024: { - "attributeName": "MicrophoneMaxLevel", + "attributeName": "ImageRotation", "attributeId": 0x00000024, "type": "int", "reportable": True, "writable": True, }, 0x00000025: { - "attributeName": "MicrophoneMinLevel", + "attributeName": "ImageFlipHorizontal", "attributeId": 0x00000025, - "type": "int", + "type": "bool", "reportable": True, "writable": True, }, 0x00000026: { - "attributeName": "MicrophoneAGCEnabled", + "attributeName": "ImageFlipVertical", "attributeId": 0x00000026, "type": "bool", "reportable": True, "writable": True, }, 0x00000027: { - "attributeName": "ImageRotation", - "attributeId": 0x00000027, - "type": "int", - "reportable": True, - }, - 0x00000028: { - "attributeName": "ImageFlipHorizontal", - "attributeId": 0x00000028, - "type": "bool", - "reportable": True, - }, - 0x00000029: { - "attributeName": "ImageFlipVertical", - "attributeId": 0x00000029, - "type": "bool", - "reportable": True, - }, - 0x0000002A: { "attributeName": "LocalVideoRecordingEnabled", - "attributeId": 0x0000002A, + "attributeId": 0x00000027, "type": "bool", "reportable": True, "writable": True, }, - 0x0000002B: { + 0x00000028: { "attributeName": "LocalSnapshotRecordingEnabled", - "attributeId": 0x0000002B, + "attributeId": 0x00000028, "type": "bool", "reportable": True, "writable": True, }, - 0x0000002C: { + 0x00000029: { "attributeName": "StatusLightEnabled", - "attributeId": 0x0000002C, + "attributeId": 0x00000029, "type": "bool", "reportable": True, "writable": True, }, - 0x0000002D: { + 0x0000002A: { "attributeName": "StatusLightBrightness", - "attributeId": 0x0000002D, - "type": "int", - "reportable": True, - "writable": True, - }, - 0x0000002E: { - "attributeName": "DepthSensorStatus", - "attributeId": 0x0000002E, + "attributeId": 0x0000002A, "type": "int", "reportable": True, "writable": True, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index b7b7328271..c9a162ac0b 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -44337,8 +44337,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="supportedZoneSources", Tag=0x00000000, Type=typing.List[ZoneManagement.Enums.ZoneSourceEnum]), ClusterObjectFieldDescriptor(Label="zones", Tag=0x00000001, Type=typing.Optional[typing.List[ZoneManagement.Structs.ZoneInformationStruct]]), - ClusterObjectFieldDescriptor(Label="timeControl", Tag=0x00000002, Type=typing.List[ZoneManagement.Structs.ZoneTriggeringTimeControlStruct]), - ClusterObjectFieldDescriptor(Label="sensitivity", Tag=0x00000003, Type=uint), + ClusterObjectFieldDescriptor(Label="triggers", Tag=0x00000002, Type=typing.List[ZoneManagement.Structs.ZoneTriggerControlStruct]), + ClusterObjectFieldDescriptor(Label="sensitivity", Tag=0x00000003, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), @@ -44348,8 +44348,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: supportedZoneSources: typing.List[ZoneManagement.Enums.ZoneSourceEnum] = field(default_factory=lambda: []) zones: typing.Optional[typing.List[ZoneManagement.Structs.ZoneInformationStruct]] = None - timeControl: typing.List[ZoneManagement.Structs.ZoneTriggeringTimeControlStruct] = field(default_factory=lambda: []) - sensitivity: uint = 0 + triggers: typing.List[ZoneManagement.Structs.ZoneTriggerControlStruct] = field(default_factory=lambda: []) + sensitivity: typing.Optional[uint] = None generatedCommandList: typing.List[uint] = field(default_factory=lambda: []) acceptedCommandList: typing.List[uint] = field(default_factory=lambda: []) attributeList: typing.List[uint] = field(default_factory=lambda: []) @@ -44413,6 +44413,7 @@ class ZoneUseEnum(MatterIntEnum): class Bitmaps: class Feature(IntFlag): kTwoDimensionalCartesianZone = 0x1 + kPerZoneSensitivity = 0x2 class Structs: @dataclass @@ -44461,7 +44462,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: zoneSource: 'ZoneManagement.Enums.ZoneSourceEnum' = 0 @dataclass - class ZoneTriggeringTimeControlStruct(ClusterObject): + class ZoneTriggerControlStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( @@ -44470,12 +44471,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="augmentationDuration", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="maxDuration", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="blindDuration", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="sensitivity", Tag=4, Type=typing.Optional[uint]), ]) initialDuration: 'uint' = 0 augmentationDuration: 'uint' = 0 maxDuration: 'uint' = 0 blindDuration: 'uint' = 0 + sensitivity: 'typing.Optional[uint]' = None class Commands: @dataclass @@ -44610,7 +44613,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: typing.Optional[typing.List[ZoneManagement.Structs.ZoneInformationStruct]] = None @dataclass - class TimeControl(ClusterAttributeDescriptor): + class Triggers(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000550 @@ -44621,9 +44624,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[ZoneManagement.Structs.ZoneTriggeringTimeControlStruct]) + return ClusterObjectFieldDescriptor(Type=typing.List[ZoneManagement.Structs.ZoneTriggerControlStruct]) - value: typing.List[ZoneManagement.Structs.ZoneTriggeringTimeControlStruct] = field(default_factory=lambda: []) + value: typing.List[ZoneManagement.Structs.ZoneTriggerControlStruct] = field(default_factory=lambda: []) @dataclass class Sensitivity(ClusterAttributeDescriptor): @@ -44637,9 +44640,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: uint = 0 + value: typing.Optional[uint] = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @@ -44799,27 +44802,23 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="hardPrivacyModeOn", Tag=0x00000017, Type=typing.Optional[bool]), ClusterObjectFieldDescriptor(Label="nightVision", Tag=0x00000018, Type=typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum]), ClusterObjectFieldDescriptor(Label="nightVisionIllum", Tag=0x00000019, Type=typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum]), - ClusterObjectFieldDescriptor(Label="AWBEnabled", Tag=0x0000001A, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="autoShutterSpeedEnabled", Tag=0x0000001B, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="autoISOEnabled", Tag=0x0000001C, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="viewport", Tag=0x0000001D, Type=typing.Optional[CameraAvStreamManagement.Structs.ViewportStruct]), - ClusterObjectFieldDescriptor(Label="speakerMuted", Tag=0x0000001E, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="speakerVolumeLevel", Tag=0x0000001F, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="speakerMaxLevel", Tag=0x00000020, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="speakerMinLevel", Tag=0x00000021, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="microphoneMuted", Tag=0x00000022, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="microphoneVolumeLevel", Tag=0x00000023, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="microphoneMaxLevel", Tag=0x00000024, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="microphoneMinLevel", Tag=0x00000025, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="microphoneAGCEnabled", Tag=0x00000026, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="imageRotation", Tag=0x00000027, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="imageFlipHorizontal", Tag=0x00000028, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="imageFlipVertical", Tag=0x00000029, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="localVideoRecordingEnabled", Tag=0x0000002A, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="localSnapshotRecordingEnabled", Tag=0x0000002B, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="statusLightEnabled", Tag=0x0000002C, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="statusLightBrightness", Tag=0x0000002D, Type=typing.Optional[Globals.Enums.ThreeLevelAutoEnum]), - ClusterObjectFieldDescriptor(Label="depthSensorStatus", Tag=0x0000002E, Type=typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum]), + ClusterObjectFieldDescriptor(Label="viewport", Tag=0x0000001A, Type=typing.Optional[CameraAvStreamManagement.Structs.ViewportStruct]), + ClusterObjectFieldDescriptor(Label="speakerMuted", Tag=0x0000001B, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="speakerVolumeLevel", Tag=0x0000001C, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="speakerMaxLevel", Tag=0x0000001D, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="speakerMinLevel", Tag=0x0000001E, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="microphoneMuted", Tag=0x0000001F, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="microphoneVolumeLevel", Tag=0x00000020, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="microphoneMaxLevel", Tag=0x00000021, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="microphoneMinLevel", Tag=0x00000022, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="microphoneAGCEnabled", Tag=0x00000023, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="imageRotation", Tag=0x00000024, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="imageFlipHorizontal", Tag=0x00000025, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="imageFlipVertical", Tag=0x00000026, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="localVideoRecordingEnabled", Tag=0x00000027, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="localSnapshotRecordingEnabled", Tag=0x00000028, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="statusLightEnabled", Tag=0x00000029, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="statusLightBrightness", Tag=0x0000002A, Type=typing.Optional[Globals.Enums.ThreeLevelAutoEnum]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), @@ -44853,9 +44852,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: hardPrivacyModeOn: typing.Optional[bool] = None nightVision: typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum] = None nightVisionIllum: typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum] = None - AWBEnabled: typing.Optional[bool] = None - autoShutterSpeedEnabled: typing.Optional[bool] = None - autoISOEnabled: typing.Optional[bool] = None viewport: typing.Optional[CameraAvStreamManagement.Structs.ViewportStruct] = None speakerMuted: typing.Optional[bool] = None speakerVolumeLevel: typing.Optional[uint] = None @@ -44873,7 +44869,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: localSnapshotRecordingEnabled: typing.Optional[bool] = None statusLightEnabled: typing.Optional[bool] = None statusLightBrightness: typing.Optional[Globals.Enums.ThreeLevelAutoEnum] = None - depthSensorStatus: typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum] = None generatedCommandList: typing.List[uint] = field(default_factory=lambda: []) acceptedCommandList: typing.List[uint] = field(default_factory=lambda: []) attributeList: typing.List[uint] = field(default_factory=lambda: []) @@ -44942,12 +44937,12 @@ class VideoCodecEnum(MatterIntEnum): class Bitmaps: class Feature(IntFlag): - kPrivacy = 0x1 - kAudio = 0x2 - kSpeaker = 0x4 - kImageControl = 0x8 - kVideo = 0x10 - kSnapshot = 0x20 + kAudio = 0x1 + kVideo = 0x2 + kSnapshot = 0x4 + kPrivacy = 0x8 + kSpeaker = 0x10 + kImageControl = 0x20 kWatermark = 0x40 kOnScreenDisplay = 0x80 kLocalStorage = 0x100 @@ -45399,70 +45394,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: imageCodec: CameraAvStreamManagement.Enums.ImageCodecEnum = 0 resolution: CameraAvStreamManagement.Structs.VideoResolutionStruct = field(default_factory=lambda: CameraAvStreamManagement.Structs.VideoResolutionStruct()) - @dataclass - class SetViewport(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000551 - command_id: typing.ClassVar[int] = 0x0000000D - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[typing.Optional[str]] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="viewport", Tag=0, Type=CameraAvStreamManagement.Structs.ViewportStruct), - ]) - - viewport: CameraAvStreamManagement.Structs.ViewportStruct = field(default_factory=lambda: CameraAvStreamManagement.Structs.ViewportStruct()) - - @dataclass - class SetImageRotation(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000551 - command_id: typing.ClassVar[int] = 0x0000000E - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[typing.Optional[str]] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="angle", Tag=0, Type=uint), - ]) - - angle: uint = 0 - - @dataclass - class SetImageFlipHorizontal(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000551 - command_id: typing.ClassVar[int] = 0x0000000F - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[typing.Optional[str]] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="enabled", Tag=0, Type=bool), - ]) - - enabled: bool = False - - @dataclass - class SetImageFlipVertical(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000551 - command_id: typing.ClassVar[int] = 0x00000010 - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[typing.Optional[str]] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="enabled", Tag=0, Type=bool), - ]) - - enabled: bool = False - class Attributes: @dataclass class MaxConcurrentVideoEncoders(ClusterAttributeDescriptor): @@ -45880,54 +45811,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum] = None - @dataclass - class AWBEnabled(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000551 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x0000001A - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) - - value: typing.Optional[bool] = None - - @dataclass - class AutoShutterSpeedEnabled(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000551 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x0000001B - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) - - value: typing.Optional[bool] = None - - @dataclass - class AutoISOEnabled(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000551 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x0000001C - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) - - value: typing.Optional[bool] = None - @dataclass class Viewport(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -45936,7 +45819,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000001D + return 0x0000001A @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -45952,7 +45835,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000001E + return 0x0000001B @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -45968,7 +45851,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000001F + return 0x0000001C @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -45984,7 +45867,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000020 + return 0x0000001D @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46000,7 +45883,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000021 + return 0x0000001E @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46016,7 +45899,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000022 + return 0x0000001F @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46032,7 +45915,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000023 + return 0x00000020 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46048,7 +45931,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000024 + return 0x00000021 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46064,7 +45947,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000025 + return 0x00000022 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46080,7 +45963,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000026 + return 0x00000023 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46096,7 +45979,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000027 + return 0x00000024 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46112,7 +45995,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000028 + return 0x00000025 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46128,7 +46011,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000029 + return 0x00000026 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46144,7 +46027,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000002A + return 0x00000027 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46160,7 +46043,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000002B + return 0x00000028 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46176,7 +46059,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000002C + return 0x00000029 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46192,7 +46075,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000002D + return 0x0000002A @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -46200,22 +46083,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: typing.Optional[Globals.Enums.ThreeLevelAutoEnum] = None - @dataclass - class DepthSensorStatus(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000551 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x0000002E - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum]) - - value: typing.Optional[CameraAvStreamManagement.Enums.TriStateAutoEnum] = None - @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index dc07e15bc2..b2c6ee2bb5 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -1159,7 +1159,7 @@ def TestResolve(self, nodeid): return False async def TestTriggerTestEventHandler(self, nodeid, enable_key, event_trigger): - self.logger.info("Test trigger test event handler for device = %08x", nodeid) + self.logger.info("Test trigger test event handler for device = %08x trigger = %016x", nodeid, event_trigger) try: await self.devCtrl.SendCommand(nodeid, 0, Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=enable_key, eventTrigger=event_trigger)) return True @@ -1167,10 +1167,10 @@ async def TestTriggerTestEventHandler(self, nodeid, enable_key, event_trigger): self.logger.exception("Failed to trigger test event handler {}".format(ex)) return False - async def TestWaitForActive(self, nodeid): + async def TestWaitForActive(self, nodeid, stayActiveDurationMs=30000): self.logger.info("Test wait for device = %08x", nodeid) try: - await self.devCtrl.WaitForActive(nodeid) + await self.devCtrl.WaitForActive(nodeid, stayActiveDurationMs=stayActiveDurationMs) return True except Exception as ex: self.logger.exception("Failed to wait for active. {}".format(ex)) diff --git a/src/controller/python/test/test_scripts/icd_wait_for_device_test.py b/src/controller/python/test/test_scripts/icd_device_test.py similarity index 83% rename from src/controller/python/test/test_scripts/icd_wait_for_device_test.py rename to src/controller/python/test/test_scripts/icd_device_test.py index e28a76e17a..e93ee5dac3 100755 --- a/src/controller/python/test/test_scripts/icd_wait_for_device_test.py +++ b/src/controller/python/test/test_scripts/icd_device_test.py @@ -35,11 +35,15 @@ async def waitForActiveAndTriggerCheckIn(test, nodeid): - coro = test.TestWaitForActive(nodeid=nodeid) - await test.TestTriggerTestEventHandler(nodeid, bytes.fromhex("00112233445566778899aabbccddeeff"), 0x0046 << 48) + coro = test.TestWaitForActive(nodeid=nodeid, stayActiveDurationMs=10) return await coro +async def invalidateHalfCounterValuesAndWaitForCheckIn(test, nodeid, testEventKey): + await test.TestTriggerTestEventHandler(nodeid, bytes.fromhex(testEventKey), 0x0046_0000_0000_0003) + return await waitForActiveAndTriggerCheckIn(test, nodeid) + + async def main(): optParser = OptionParser() optParser.add_option( @@ -108,6 +112,15 @@ async def main(): help="Discovery type of commissioning. (0: networkOnly 1: networkOnlyWithoutPASEAutoRetry 2: All)", metavar="" ) + optParser.add_option( + "--test-event-key", + action="store", + dest="testEventKey", + default="00112233445566778899aabbccddeeff", + type=str, + help="Enable key of Test event trigger.", + metavar="" + ) (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) @@ -125,9 +138,14 @@ async def main(): nodeid=options.nodeid), "Failed to finish key exchange") logger.info("Commissioning completed") + logger.info("Testing wait for active") FailIfNot(await waitForActiveAndTriggerCheckIn(test, nodeid=options.nodeid), "Failed to test wait for active") - logger.info('Successfully handled wait-for-active') + logger.info("Successfully handled wait-for-active") + + logger.info("Testing InvalidateHalfCounterValues for refresh key") + FailIfNot(await invalidateHalfCounterValuesAndWaitForCheckIn(test, nodeid=options.nodeid, testEventKey=options.testEventKey), "Failed to test wait for active") + logger.info("Successfully handled key refresh") timeoutTicker.stop() diff --git a/src/controller/tests/TestEventChunking.cpp b/src/controller/tests/TestEventChunking.cpp index 74ba871547..d0f4999ee7 100644 --- a/src/controller/tests/TestEventChunking.cpp +++ b/src/controller/tests/TestEventChunking.cpp @@ -187,7 +187,6 @@ void TestReadCallback::OnAttributeData(const app::ConcreteDataAttributePath & aP { app::DataModel::DecodableList v; EXPECT_EQ(app::DataModel::Decode(*apData, v), CHIP_NO_ERROR); - auto it = v.begin(); size_t arraySize = 0; EXPECT_EQ(v.ComputeSize(&arraySize), CHIP_NO_ERROR); EXPECT_EQ(arraySize, 4u); diff --git a/src/controller/tests/data_model/DataModelFixtures.cpp b/src/controller/tests/data_model/DataModelFixtures.cpp index a5533dc51d..6f42c38a77 100644 --- a/src/controller/tests/data_model/DataModelFixtures.cpp +++ b/src/controller/tests/data_model/DataModelFixtures.cpp @@ -18,6 +18,7 @@ #include "DataModelFixtures.h" +#include #include #include #include @@ -84,9 +85,9 @@ CommandHandler::Handle gAsyncCommandHandle; } // namespace DataModelTests -CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, - const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, - AttributeEncodeState * apEncoderState) +static CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, + const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, + AttributeEncodeState * apEncoderState) { if (aPath.mEndpointId >= chip::Test::kMockEndpointMin) { @@ -223,175 +224,6 @@ CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescr return CHIP_NO_ERROR; } -bool IsClusterDataVersionEqual(const app::ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) -{ - if (aRequiredVersion == kDataVersion) - { - return true; - } - if (Test::GetVersion() == aRequiredVersion) - { - return true; - } - - return false; -} - -bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) -{ - return false; -} - -Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) -{ - return Protocols::InteractionModel::Status::Success; -} - -const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) -{ - // Note: This test does not make use of the real attribute metadata. - static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; - return &stub; -} - -CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, - TLV::TLVReader & aReader, WriteHandler * aWriteHandler) -{ - static ListIndex listStructOctetStringElementCount = 0; - - if (aPath.mDataVersion.HasValue() && aPath.mDataVersion.Value() == kRejectedDataVersion) - { - return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::DataVersionMismatch); - } - - if (aPath.mClusterId == Clusters::UnitTesting::Id && - aPath.mAttributeId == Attributes::ListStructOctetString::TypeInfo::GetAttributeId()) - { - if (gWriteResponseDirective == WriteResponseDirective::kSendAttributeSuccess) - { - if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) - { - - Attributes::ListStructOctetString::TypeInfo::DecodableType value; - - ReturnErrorOnFailure(DataModel::Decode(aReader, value)); - - auto iter = value.begin(); - listStructOctetStringElementCount = 0; - while (iter.Next()) - { - auto & item = iter.GetValue(); - - VerifyOrReturnError(item.member1 == listStructOctetStringElementCount, CHIP_ERROR_INVALID_ARGUMENT); - listStructOctetStringElementCount++; - } - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) - { - Structs::TestListStructOctet::DecodableType item; - ReturnErrorOnFailure(DataModel::Decode(aReader, item)); - VerifyOrReturnError(item.member1 == listStructOctetStringElementCount, CHIP_ERROR_INVALID_ARGUMENT); - listStructOctetStringElementCount++; - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - } - else - { - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Failure); - } - - return CHIP_NO_ERROR; - } - if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::ListFabricScoped::Id) - { - // Mock an invalid SubjectDescriptor. - // NOTE: completely ignores the passed-in subjectDescriptor - AttributeValueDecoder decoder(aReader, Access::SubjectDescriptor()); - if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) - { - Attributes::ListFabricScoped::TypeInfo::DecodableType value; - - ReturnErrorOnFailure(decoder.Decode(value)); - - auto iter = value.begin(); - while (iter.Next()) - { - auto & item = iter.GetValue(); - (void) item; - } - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) - { - Structs::TestFabricScoped::DecodableType item; - ReturnErrorOnFailure(decoder.Decode(item)); - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - return CHIP_NO_ERROR; - } - - // Boolean attribute of unit testing cluster triggers "multiple errors" case. - if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Boolean::TypeInfo::GetAttributeId()) - { - Protocols::InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; - - if (gWriteResponseDirective == WriteResponseDirective::kSendMultipleSuccess) - { - status = Protocols::InteractionModel::Status::Success; - } - else if (gWriteResponseDirective == WriteResponseDirective::kSendMultipleErrors) - { - status = Protocols::InteractionModel::Status::Failure; - } - else - { - VerifyOrDie(false); - } - - for (size_t i = 0; i < 4; ++i) - { - aWriteHandler->AddStatus(aPath, status); - } - - return CHIP_NO_ERROR; - } - - if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Int8u::TypeInfo::GetAttributeId()) - { - Protocols::InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; - if (gWriteResponseDirective == WriteResponseDirective::kSendClusterSpecificSuccess) - { - status = Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kExampleClusterSpecificSuccess); - } - else if (gWriteResponseDirective == WriteResponseDirective::kSendClusterSpecificFailure) - { - status = Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kExampleClusterSpecificFailure); - } - else - { - VerifyOrDie(false); - } - - aWriteHandler->AddStatus(aPath, status); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; -} - void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, chip::TLV::TLVReader & aReader, CommandHandler * apCommandObj) { @@ -480,24 +312,6 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, chip } } -Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) -{ - // Mock cluster catalog, only support commands on one cluster on one endpoint. - using Protocols::InteractionModel::Status; - - if (aCommandPath.mEndpointId != DataModelTests::kTestEndpointId) - { - return Status::UnsupportedEndpoint; - } - - if (aCommandPath.mClusterId != Clusters::UnitTesting::Id) - { - return Status::UnsupportedCluster; - } - - return Status::Success; -} - CustomDataModel & CustomDataModel::Instance() { static CustomDataModel model; @@ -508,22 +322,13 @@ ActionReturnStatus CustomDataModel::ReadAttribute(const ReadAttributeRequest & r { AttributeEncodeState mutableState(&encoder.GetState()); // provide a state copy to start. -#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE - if ((request.path.mEndpointId < chip::Test::kMockEndpointMin) && - (gReadResponseDirective == ReadResponseDirective::kSendDataResponse) && - (request.path.mClusterId == app::Clusters::UnitTesting::Id) && - (request.path.mAttributeId == app::Clusters::UnitTesting::Attributes::Int16u::Id)) + Access::SubjectDescriptor subjectDescriptor; + if (request.subjectDescriptor != nullptr) { - // gInt16uTotalReadCount is a global that keeps changing. Further more, encoding - // size differs when moving from 0xFF to 0x100, so encoding sizes in TLV differ. - // - // This is a HACKISH workaround as it relies that we ember-read before datamodel-read - gInt16uTotalReadCount--; + subjectDescriptor = *request.subjectDescriptor; } -#endif // CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE - CHIP_ERROR err = ReadSingleClusterData(request.subjectDescriptor.value_or(Access::SubjectDescriptor()), - request.readFlags.Has(ReadFlags::kFabricFiltered), request.path, + CHIP_ERROR err = ReadSingleClusterData(subjectDescriptor, request.readFlags.Has(ReadFlags::kFabricFiltered), request.path, TestOnlyAttributeValueEncoderAccessor(encoder).Builder(), &mutableState); // state must survive CHIP_ERRORs as it is used for chunking diff --git a/src/controller/tests/data_model/DataModelFixtures.h b/src/controller/tests/data_model/DataModelFixtures.h index bdc251ecb7..e9b32aead6 100644 --- a/src/controller/tests/data_model/DataModelFixtures.h +++ b/src/controller/tests/data_model/DataModelFixtures.h @@ -115,11 +115,6 @@ class CustomDataModel : public DataModel::Provider CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } - bool EventPathIncludesAccessibleConcretePath(const EventPathParams & path, - const Access::SubjectDescriptor & descriptor) override - { - return true; - } DataModel::ActionReturnStatus ReadAttribute(const DataModel::ReadAttributeRequest & request, AttributeValueEncoder & encoder) override; DataModel::ActionReturnStatus WriteAttribute(const DataModel::WriteAttributeRequest & request, diff --git a/src/crypto/CHIPCryptoPAL.cpp b/src/crypto/CHIPCryptoPAL.cpp index 2caecbcb15..1ac01d033d 100644 --- a/src/crypto/CHIPCryptoPAL.cpp +++ b/src/crypto/CHIPCryptoPAL.cpp @@ -330,16 +330,16 @@ CHIP_ERROR Spake2p::BeginVerifier(const uint8_t * my_identity, size_t my_identit } CHIP_ERROR Spake2p::BeginProver(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, - size_t peer_identity_len, const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, - size_t w1in_len) + size_t peer_identity_len, const uint8_t * w0sin, size_t w0sin_len, const uint8_t * w1sin, + size_t w1sin_len) { VerifyOrReturnError(state == CHIP_SPAKE2P_STATE::INIT, CHIP_ERROR_INTERNAL); ReturnErrorOnFailure(InternalHash(my_identity, my_identity_len)); ReturnErrorOnFailure(InternalHash(peer_identity, peer_identity_len)); ReturnErrorOnFailure(WriteMN()); - ReturnErrorOnFailure(FELoad(w0in, w0in_len, w0)); - ReturnErrorOnFailure(FELoad(w1in, w1in_len, w1)); + ReturnErrorOnFailure(FELoad(w0sin, w0sin_len, w0)); + ReturnErrorOnFailure(FELoad(w1sin, w1sin_len, w1)); state = CHIP_SPAKE2P_STATE::STARTED; role = CHIP_SPAKE2P_ROLE::PROVER; diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index 80611e93d1..45e13f26bb 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -942,6 +942,9 @@ class Hash_SHA256_stream private: HashSHA256OpaqueContext mContext; +#if CHIP_CRYPTO_BORINGSSL || CHIP_CRYPTO_OPENSSL + bool mInitialized = false; +#endif }; class HKDF_sha @@ -1160,16 +1163,16 @@ class Spake2p * @param my_identity_len The prover identity length. * @param peer_identity The peer identity. May be NULL if identities are not established. * @param peer_identity_len The peer identity length. - * @param w0in The input w0 (an output from the PBKDF). - * @param w0in_len The input w0 length. - * @param w1in The input w1 (an output from the PBKDF). - * @param w1in_len The input w1 length. + * @param w0sin The input w0s (an output from the PBKDF). + * @param w0sin_len The input w0s length. + * @param w1sin The input w1s (an output from the PBKDF). + * @param w1sin_len The input w1s length. * * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ virtual CHIP_ERROR BeginProver(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, - size_t peer_identity_len, const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, - size_t w1in_len); + size_t peer_identity_len, const uint8_t * w0sin, size_t w0sin_len, const uint8_t * w1sin, + size_t w1sin_len); /** * @brief Compute the first round of the protocol. @@ -1344,26 +1347,26 @@ class Spake2p /* * @synopsis Compute w0sin mod p * - * @param w0out Output field element (modulo p) + * @param w0out Output field element w0 * @param w0_len Output field element length - * @param w1sin Input field element - * @param w1sin_len Input field element length + * @param w0sin Input field element + * @param w0sin_len Input field element length * * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ virtual CHIP_ERROR ComputeW0(uint8_t * w0out, size_t * w0_len, const uint8_t * w0sin, size_t w0sin_len) = 0; /* - * @synopsis Compute w1in*G + * @synopsis Compute w1in*G where w1in is w1sin mod p * * @param Lout Output point in 0x04 || X || Y format. * @param L_len Output point length - * @param w1in Input field element - * @param w1in_len Input field element size + * @param w1sin Input field element + * @param w1sin_len Input field element size * * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ - virtual CHIP_ERROR ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) = 0; + virtual CHIP_ERROR ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) = 0; void * M; void * N; @@ -1518,7 +1521,7 @@ class Spake2p_P256_SHA256_HKDF_HMAC : public Spake2p CHIP_ERROR PointIsValid(void * R) override; CHIP_ERROR ComputeW0(uint8_t * w0out, size_t * w0_len, const uint8_t * w0sin, size_t w0sin_len) override; - CHIP_ERROR ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) override; + CHIP_ERROR ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) override; protected: CHIP_ERROR InitImpl() override; @@ -1558,12 +1561,12 @@ class Spake2pVerifier CHIP_ERROR Generate(uint32_t pbkdf2IterCount, const ByteSpan & salt, uint32_t setupPin); /** - * @brief Compute the initiator values (w0, w1) used for PAKE input. + * @brief Compute the initiator values (w0s, w1s) used for PAKE input. * * @param pbkdf2IterCount Iteration count for PBKDF2 function * @param salt Salt to be used for Spake2+ operation * @param setupPin Provided setup PIN (passcode) - * @param ws The output pair (w0, w1) stored sequentially + * @param ws The output pair (w0s, w1s) stored sequentially * @param ws_len The output length * * @return CHIP_ERROR The result from running PBKDF2 diff --git a/src/crypto/CHIPCryptoPALOpenSSL.cpp b/src/crypto/CHIPCryptoPALOpenSSL.cpp index c1182ac8eb..033be44888 100644 --- a/src/crypto/CHIPCryptoPALOpenSSL.cpp +++ b/src/crypto/CHIPCryptoPALOpenSSL.cpp @@ -433,36 +433,57 @@ CHIP_ERROR Hash_SHA1(const uint8_t * data, const size_t data_length, uint8_t * o return CHIP_NO_ERROR; } -Hash_SHA256_stream::Hash_SHA256_stream() {} +// For OpenSSL, we store a pointer to the digest context (EVP_MD_CTX) since EVP_MD_CTX is Opaque. +static_assert(kMAX_Hash_SHA256_Context_Size >= sizeof(void *), + "kMAX_Hash_SHA256_Context_Size needs to at least be able to store a pointer"); -Hash_SHA256_stream::~Hash_SHA256_stream() +// Storing a pointer to EVP_MD_CTX in HashSHA256OpaqueContext instead of the actual EVP_MD_CTX structure, as EVP_MD_CTX was made +// opaque by OpenSSL and is dynamically allocated. +static inline void set_inner_hash_evp_md_ctx(HashSHA256OpaqueContext * context, EVP_MD_CTX * evp_ctx) { - Clear(); + *SafePointerCast(context) = evp_ctx; } -static_assert(kMAX_Hash_SHA256_Context_Size >= sizeof(SHA256_CTX), - "kMAX_Hash_SHA256_Context_Size is too small for the size of underlying SHA256_CTX"); +static inline EVP_MD_CTX * to_inner_hash_evp_md_ctx(HashSHA256OpaqueContext * context) +{ + return *SafePointerCast(context); +} -static inline SHA256_CTX * to_inner_hash_sha256_context(HashSHA256OpaqueContext * context) +Hash_SHA256_stream::Hash_SHA256_stream() : mInitialized(false) { - return SafePointerCast(context); + set_inner_hash_evp_md_ctx(&mContext, nullptr); +} + +Hash_SHA256_stream::~Hash_SHA256_stream() +{ + Clear(); } CHIP_ERROR Hash_SHA256_stream::Begin() { - SHA256_CTX * const context = to_inner_hash_sha256_context(&mContext); - const int result = SHA256_Init(context); + EVP_MD_CTX * mdctx = EVP_MD_CTX_new(); + VerifyOrReturnError(mdctx != nullptr, CHIP_ERROR_INTERNAL); + + set_inner_hash_evp_md_ctx(&mContext, mdctx); + + const int result = EVP_DigestInit_ex(mdctx, _digestForType(DigestType::SHA256), nullptr); + VerifyOrReturnError(result == 1, CHIP_ERROR_INTERNAL); + mInitialized = true; return CHIP_NO_ERROR; } CHIP_ERROR Hash_SHA256_stream::AddData(const ByteSpan data) { - SHA256_CTX * const context = to_inner_hash_sha256_context(&mContext); + VerifyOrReturnError(mInitialized, CHIP_ERROR_UNINITIALIZED); + + EVP_MD_CTX * mdctx = to_inner_hash_evp_md_ctx(&mContext); + VerifyOrReturnError(mdctx != nullptr, CHIP_ERROR_INTERNAL); + + const int result = EVP_DigestUpdate(mdctx, data.data(), data.size()); - const int result = SHA256_Update(context, Uint8::to_const_uchar(data.data()), data.size()); VerifyOrReturnError(result == 1, CHIP_ERROR_INTERNAL); return CHIP_NO_ERROR; @@ -470,27 +491,43 @@ CHIP_ERROR Hash_SHA256_stream::AddData(const ByteSpan data) CHIP_ERROR Hash_SHA256_stream::GetDigest(MutableByteSpan & out_buffer) { - SHA256_CTX * context = to_inner_hash_sha256_context(&mContext); - // Back-up context as we are about to finalize the hash to extract digest. - SHA256_CTX previous_ctx = *context; + VerifyOrReturnError(mInitialized, CHIP_ERROR_UNINITIALIZED); + + EVP_MD_CTX * mdctx = to_inner_hash_evp_md_ctx(&mContext); + + // Back-up the context as we are about to finalize the hash to extract digest. + EVP_MD_CTX * previous_mdctx = EVP_MD_CTX_new(); + VerifyOrReturnError(previous_mdctx != nullptr, CHIP_ERROR_INTERNAL); + const int copy_result = EVP_MD_CTX_copy_ex(previous_mdctx, mdctx); + VerifyOrReturnError(copy_result == 1, CHIP_ERROR_INTERNAL); // Pad + compute digest, then finalize context. It is restored next line to continue. CHIP_ERROR result = Finish(out_buffer); - // Restore context prior to finalization. - *context = previous_ctx; + // free the finalized context. + EVP_MD_CTX_free(mdctx); + + // Restore the backed up context, to be able to get intermediate digest again if needed + set_inner_hash_evp_md_ctx(&mContext, previous_mdctx); return result; } CHIP_ERROR Hash_SHA256_stream::Finish(MutableByteSpan & out_buffer) { + unsigned int size; + VerifyOrReturnError(out_buffer.size() >= kSHA256_Hash_Length, CHIP_ERROR_BUFFER_TOO_SMALL); + VerifyOrReturnError(mInitialized, CHIP_ERROR_UNINITIALIZED); + + EVP_MD_CTX * mdctx = to_inner_hash_evp_md_ctx(&mContext); + + const int result = EVP_DigestFinal_ex(mdctx, out_buffer.data(), &size); - SHA256_CTX * const context = to_inner_hash_sha256_context(&mContext); - const int result = SHA256_Final(Uint8::to_uchar(out_buffer.data()), context); VerifyOrReturnError(result == 1, CHIP_ERROR_INTERNAL); + VerifyOrReturnError(size == kSHA256_Hash_Length, CHIP_ERROR_INTERNAL); + out_buffer = out_buffer.SubSpan(0, kSHA256_Hash_Length); return CHIP_NO_ERROR; @@ -498,6 +535,13 @@ CHIP_ERROR Hash_SHA256_stream::Finish(MutableByteSpan & out_buffer) void Hash_SHA256_stream::Clear() { + EVP_MD_CTX * mdctx = to_inner_hash_evp_md_ctx(&mContext); + + // EVP_MD_CTX_free does nothing if a nullptr is passed to it + EVP_MD_CTX_free(mdctx); + set_inner_hash_evp_md_ctx(&mContext, nullptr); + + mInitialized = false; OPENSSL_cleanse(this, sizeof(*this)); } @@ -1405,6 +1449,8 @@ void Spake2p_P256_SHA256_HKDF_HMAC::Clear() BN_CTX_free(context->bn_ctx); } + sha256_hash_ctx.Clear(); + free_point(M); free_point(N); free_point(X); @@ -1562,7 +1608,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_ERROR_INTERNAL; int error_openssl = 0; @@ -1577,8 +1623,8 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le Lout_point = EC_POINT_new(context->curve); VerifyOrExit(Lout_point != nullptr, error = CHIP_ERROR_INTERNAL); - VerifyOrExit(CanCastTo(w1in_len), error = CHIP_ERROR_INTERNAL); - BN_bin2bn(Uint8::to_const_uchar(w1in), static_cast(w1in_len), w1_bn); + VerifyOrExit(CanCastTo(w1sin_len), error = CHIP_ERROR_INTERNAL); + BN_bin2bn(Uint8::to_const_uchar(w1sin), static_cast(w1sin_len), w1_bn); error_openssl = BN_mod(w1_bn, w1_bn, (BIGNUM *) order, context->bn_ctx); VerifyOrExit(error_openssl == 1, error = CHIP_ERROR_INTERNAL); diff --git a/src/crypto/CHIPCryptoPALPSA.cpp b/src/crypto/CHIPCryptoPALPSA.cpp index ba34669a51..eb67240232 100644 --- a/src/crypto/CHIPCryptoPALPSA.cpp +++ b/src/crypto/CHIPCryptoPALPSA.cpp @@ -1042,7 +1042,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -1058,7 +1058,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le result = mbedtls_ecp_group_load(&curve, MBEDTLS_ECP_DP_SECP256R1); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1in), w1in_len); + result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1sin), w1sin_len); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); result = mbedtls_mpi_mod_mpi(&w1_bn, &w1_bn, &curve.N); diff --git a/src/crypto/CHIPCryptoPALmbedTLS.cpp b/src/crypto/CHIPCryptoPALmbedTLS.cpp index 4df0ce97e3..b2726424ab 100644 --- a/src/crypto/CHIPCryptoPALmbedTLS.cpp +++ b/src/crypto/CHIPCryptoPALmbedTLS.cpp @@ -1092,7 +1092,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -1108,7 +1108,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le result = mbedtls_ecp_group_load(&curve, MBEDTLS_ECP_DP_SECP256R1); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1in), w1in_len); + result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1sin), w1sin_len); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); result = mbedtls_mpi_mod_mpi(&w1_bn, &w1_bn, &curve.N); diff --git a/src/crypto/PSASpake2p.cpp b/src/crypto/PSASpake2p.cpp index ae98b083c8..6625f970db 100644 --- a/src/crypto/PSASpake2p.cpp +++ b/src/crypto/PSASpake2p.cpp @@ -94,11 +94,11 @@ CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::BeginVerifier(const uint8_t * my_id CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, size_t peer_identity_len, - const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, - size_t w1in_len) + const uint8_t * w0sin, size_t w0sin_len, const uint8_t * w1sin, + size_t w1sin_len) { - VerifyOrReturnError(w0in_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(w1in_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(w0sin_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(w1sin_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); uint8_t password[kSpake2p_WS_Length * 2]; psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; @@ -107,13 +107,13 @@ CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_iden psa_pake_cs_set_algorithm(&cp, PSA_ALG_SPAKE2P_MATTER); psa_pake_cs_set_primitive(&cp, PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256)); - memcpy(password + 0, w0in, w0in_len); - memcpy(password + w0in_len, w1in, w1in_len); + memcpy(password + 0, w0sin, w0sin_len); + memcpy(password + w0sin_len, w1sin, w1sin_len); psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE); psa_set_key_algorithm(&attributes, PSA_ALG_SPAKE2P_MATTER); psa_set_key_type(&attributes, PSA_KEY_TYPE_SPAKE2P_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); - psa_status_t status = psa_import_key(&attributes, password, w0in_len + w1in_len, &mKey); + psa_status_t status = psa_import_key(&attributes, password, w0sin_len + w1sin_len, &mKey); psa_reset_key_attributes(&attributes); VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); diff --git a/src/crypto/PSASpake2p.h b/src/crypto/PSASpake2p.h index 9907b1ec09..1637690370 100644 --- a/src/crypto/PSASpake2p.h +++ b/src/crypto/PSASpake2p.h @@ -89,15 +89,16 @@ class PSASpake2p_P256_SHA256_HKDF_HMAC * @param my_identity_len The prover identity length. * @param peer_identity The peer identity. May be NULL if identities are not established. * @param peer_identity_len The peer identity length. - * @param w0in The input w0 (an output from the PBKDF). - * @param w0in_len The input w0 length. - * @param w1in The input w1 (an output from the PBKDF). - * @param w1in_len The input w1 length. + * @param w0sin The input w0s (an output from the PBKDF). + * @param w0sin_len The input w0s length. + * @param w1sin The input w1s (an output from the PBKDF). + * @param w1sin_len The input w1s length. * * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ CHIP_ERROR BeginProver(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, - size_t peer_identity_len, const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, size_t w1in_len); + size_t peer_identity_len, const uint8_t * w0sin, size_t w0sin_len, const uint8_t * w1sin, + size_t w1sin_len); /** * @brief Compute the first round of the protocol. diff --git a/src/darwin/Framework/CHIP/MTRAttributeValueWaiter.h b/src/darwin/Framework/CHIP/MTRAttributeValueWaiter.h new file mode 100644 index 0000000000..98ee86a800 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRAttributeValueWaiter.h @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +MTR_NEWLY_AVAILABLE +@interface MTRAttributeValueWaiter : NSObject +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +/** + * Cancel the wait for the set of attribute path/value pairs represented by this + * MTRAttributeValueWaiter. If the completion has not been called yet, it will + * becalled with MTRErrorCodeCancelled. + */ +- (void)cancel; + +@property (readonly, nonatomic) NSUUID * UUID; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRAttributeValueWaiter.mm b/src/darwin/Framework/CHIP/MTRAttributeValueWaiter.mm new file mode 100644 index 0000000000..10d0b9f8e1 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRAttributeValueWaiter.mm @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import + +#import "MTRAttributeValueWaiter_Internal.h" +#import "MTRDevice_Internal.h" +#import "MTRLogging_Internal.h" + +@implementation MTRAwaitedAttributeState +- (instancetype)initWithValue:(MTRDeviceDataValueDictionary)value +{ + if (self = [super init]) { + _valueSatisfied = NO; + _value = value; + } + + return self; +} +@end + +MTR_DIRECT_MEMBERS +@interface MTRAttributeValueWaiter () +@property (nonatomic, retain) NSDictionary * valueExpectations; +// Protected by the MTRDevice's lock. +@property (nonatomic, readwrite, retain) dispatch_queue_t queue; +@property (nonatomic, readwrite, copy, nullable) MTRStatusCompletion completion; +@property (nonatomic, readonly, retain) MTRDevice * device; +@end + +@implementation MTRAttributeValueWaiter + +- (instancetype)initWithDevice:(MTRDevice *)device values:(NSDictionary *)values queue:(dispatch_queue_t)queue completion:(MTRStatusCompletion)completion +{ + if (self = [super init]) { + auto * valueExpectations = [NSMutableDictionary dictionaryWithCapacity:values.count]; + for (MTRAttributePath * path in values) { + auto * valueExpectation = [[MTRAwaitedAttributeState alloc] initWithValue:values[path]]; + valueExpectations[path] = valueExpectation; + } + _valueExpectations = valueExpectations; + _queue = queue; + _completion = completion; + _device = device; + _UUID = [NSUUID UUID]; + } + + return self; +} + +- (void)dealloc +{ + [self cancel]; +} + +- (void)cancel +{ + [self.device _attributeWaitCanceled:self]; +} + +- (BOOL)_attributeValue:(MTRDeviceDataValueDictionary)value reportedForPath:(MTRAttributePath *)path byDevice:(MTRDevice *)device +{ + MTRAwaitedAttributeState * valueExpectation = self.valueExpectations[path]; + if (!valueExpectation) { + // We don't care about this one. + return NO; + } + + MTRDeviceDataValueDictionary expectedValue = valueExpectation.value; + valueExpectation.valueSatisfied = [device _attributeDataValue:value satisfiesValueExpectation:expectedValue]; + return valueExpectation.valueSatisfied; +} + +- (BOOL)allValuesSatisfied +{ + for (MTRAwaitedAttributeState * valueExpectation in [self.valueExpectations allValues]) { + if (!valueExpectation.valueSatisfied) { + return NO; + } + } + + return YES; +} + +- (void)_notifyWithError:(NSError * _Nullable)error +{ + // This is always called with the device lock held, so checking and mutating + // self.completion here is atomic. + if (!self.completion) { + return; + } + + if (self.expirationTimer != nil) { + dispatch_source_cancel(self.expirationTimer); + self.expirationTimer = nil; + } + + if (!error) { + MTR_LOG("%@ %p wait for attribute values completed", self, self); + } else if (error.domain == MTRErrorDomain && error.code == MTRErrorCodeTimeout) { + MTR_LOG("%@ %p wait for attribute values timed out", self, self); + } else if (error.domain == MTRErrorDomain && error.code == MTRErrorCodeCancelled) { + MTR_LOG("%@ %p wait for attribute values canceled", self, self); + } else { + MTR_LOG("%@ %p wait for attribute values unknown error: %@", self, self, error); + } + + auto completion = self.completion; + auto queue = self.queue; + self.completion = nil; + self.queue = nil; + dispatch_async(queue, ^{ + completion(error); + }); +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %@>", NSStringFromClass(self.class), self.UUID]; +} + +@end diff --git a/src/darwin/Framework/CHIP/MTRAttributeValueWaiter_Internal.h b/src/darwin/Framework/CHIP/MTRAttributeValueWaiter_Internal.h new file mode 100644 index 0000000000..8d4a799969 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRAttributeValueWaiter_Internal.h @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#import // For MTRAttributePath. +#import +#import + +#import "MTRDefines_Internal.h" + +NS_ASSUME_NONNULL_BEGIN + +// Represents the state of a single attribute being waited for: has the path and +// value being waited for in the response-value and whether the value has been +// reached. +MTR_DIRECT_MEMBERS +@interface MTRAwaitedAttributeState : NSObject +@property (nonatomic, assign, readwrite) BOOL valueSatisfied; +@property (nonatomic, retain, readonly) MTRDeviceDataValueDictionary value; + +- (instancetype)initWithValue:(MTRDeviceDataValueDictionary)value; +@end + +@interface MTRAttributeValueWaiter () + +@property (nonatomic, readonly) BOOL allValuesSatisfied; +@property (nonatomic, retain, readwrite, nullable) dispatch_source_t expirationTimer; + +- (instancetype)initWithDevice:(MTRDevice *)device values:(NSDictionary *)values queue:(dispatch_queue_t)queue completion:(MTRStatusCompletion)completion; + +// Returns YES if after this report the waiter might be done waiting, NO otherwise. +- (BOOL)_attributeValue:(MTRDeviceDataValueDictionary)value reportedForPath:(MTRAttributePath *)path byDevice:(MTRDevice *)device; + +- (void)_notifyWithError:(NSError * _Nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h b/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h index e1b935ca66..592e1ac527 100644 --- a/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h +++ b/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h @@ -168,27 +168,20 @@ typedef NS_ENUM(uint8_t, MTROTASoftwareUpdateRequestorOTAUpdateState) { * SaturationMoveMode and SaturationStepMode. */ typedef NS_ENUM(uint8_t, MTRColorControlSaturationMoveMode) { - MTRColorControlSaturationMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeStop") + MTRColorControlSaturationMoveModeStop MTR_DEPRECATED("Please use MTRColorControlMoveModeStop", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x00, - MTRColorControlSaturationMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeUp") + MTRColorControlSaturationMoveModeUp MTR_DEPRECATED("Please use MTRColorControlMoveModeUp", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x01, - MTRColorControlSaturationMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeDown") + MTRColorControlSaturationMoveModeDown MTR_DEPRECATED("Please use MTRColorControlMoveModeDown", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveMode"); +} MTR_DEPRECATED("Please use MTRColorControlMoveMode", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); typedef NS_ENUM(uint8_t, MTRColorControlSaturationStepMode) { - MTRColorControlSaturationStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeUp") + MTRColorControlSaturationStepModeUp MTR_DEPRECATED("Please use MTRColorControlStepModeUp", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x01, - MTRColorControlSaturationStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeDown") + MTRColorControlSaturationStepModeDown MTR_DEPRECATED("Please use MTRColorControlStepModeDown", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepMode"); +} MTR_DEPRECATED("Please use MTRColorControlStepMode", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); #pragma mark - Clusters that were removed wholesale: OnOffSwitchConfiguration diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index 2f75038eda..0f86a76b8a 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -23,6 +23,7 @@ #import "MTRCluster.h" #import "MTRClusterStateCacheContainer_Internal.h" #import "MTRCluster_Internal.h" +#import "MTRDeviceDataValidation.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" #import "MTREventTLVValueDecoder_Internal.h" @@ -232,11 +233,6 @@ - (void)onDone @end -@interface MTRBaseDevice () -// Will return nil if our controller is not in fact a concrete controller. -@property (nullable, nonatomic, strong, readonly) MTRDeviceController_Concrete * concreteController; -@end - @implementation MTRBaseDevice - (instancetype)initWithPASEDevice:(chip::DeviceProxy *)device controller:(MTRDeviceController *)controller diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h index 075ee99da2..4cf02ebd8e 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h @@ -18,7 +18,8 @@ #import "MTRBaseDevice.h" #import -#import "MTRDeviceDataValueDictionary.h" +#import "MTRDefines_Internal.h" +#import "MTRDeviceController_Concrete.h" #include #include @@ -210,6 +211,11 @@ static inline MTRTransportType MTRMakeTransportType(chip::Transport::Type type) queue:(dispatch_queue_t)queue completion:(MTRDeviceResponseHandler)completion; +/** + * Will return nil if our controller is not in fact a concrete controller. + */ +@property (nullable, nonatomic, strong, readonly) MTRDeviceController_Concrete * concreteController; + @end @interface MTRClusterPath () diff --git a/src/darwin/Framework/CHIP/MTRCallbackBridgeBase.h b/src/darwin/Framework/CHIP/MTRCallbackBridgeBase.h index d9c98157c2..e8b0d1efc6 100644 --- a/src/darwin/Framework/CHIP/MTRCallbackBridgeBase.h +++ b/src/darwin/Framework/CHIP/MTRCallbackBridgeBase.h @@ -18,8 +18,10 @@ #import #import "MTRBaseDevice_Internal.h" +#import "MTRDeviceController_Concrete.h" #import "MTRDeviceController_Internal.h" #import "MTRError_Internal.h" +#import "MTRLogging_Internal.h" #import "zap-generated/MTRBaseClusters.h" #include @@ -36,17 +38,6 @@ NS_ASSUME_NONNULL_BEGIN */ class MTRCallbackBridgeBase { public: - /** - * Run the given MTRActionBlock on the Matter thread, after getting a CASE - * session (possibly pre-existing) to the given node ID on the fabric - * represented by the given MTRDeviceController. On success, convert the - * success value to whatever type it needs to be to call the callback type - * we're templated over. Once this function has been called, on a callback - * bridge allocated with `new`, the bridge object must not be accessed by - * the caller. The action block will handle deleting the bridge. - */ - void DispatchAction(chip::NodeId nodeID, MTRDeviceController * controller) && { ActionWithNodeID(nodeID, controller); } - /** * Run the given MTRActionBlock on the Matter thread after getting a secure * session corresponding to the given MTRBaseDevice. On success, convert @@ -60,7 +51,7 @@ class MTRCallbackBridgeBase { if (device.isPASEDevice) { ActionWithPASEDevice(device); } else { - ActionWithNodeID(device.nodeID, device.deviceController); + ActionWithNodeID(device.nodeID, device.concreteController); } } @@ -81,22 +72,30 @@ class MTRCallbackBridgeBase { { LogRequestStart(); - // TODO: Figure out whether we can usefully get an MTRDeviceController_Concrete in here, so - // we can move getSessionForCommissioneeDevice off of MTRDeviceController_Internal. Ideally - // without bloating this inline method too much. - [device.deviceController getSessionForCommissioneeDevice:device.nodeID - completion:^(chip::Messaging::ExchangeManager * exchangeManager, - const chip::Optional & session, NSError * _Nullable error, NSNumber * _Nullable retryDelay) { - MaybeDoAction(exchangeManager, session, error); - }]; + MTRDeviceController_Concrete * _Nullable controller = device.concreteController; + if (!controller) { + MTR_LOG_ERROR("Trying to perform action with PASE device with a non-concrete controller"); + MaybeDoAction(nullptr, chip::NullOptional, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); + return; + } + + [controller getSessionForCommissioneeDevice:device.nodeID + completion:^(chip::Messaging::ExchangeManager * exchangeManager, + const chip::Optional & session, NSError * _Nullable error, NSNumber * _Nullable retryDelay) { + MaybeDoAction(exchangeManager, session, error); + }]; } - void ActionWithNodeID(chip::NodeId nodeID, MTRDeviceController * controller) + void ActionWithNodeID(chip::NodeId nodeID, MTRDeviceController_Concrete * _Nullable controller) { LogRequestStart(); - // TODO: Figure out whether we can usefully get an MTRDeviceController_Concrete in here, so - // we can move getSessionForNode off of MTRDeviceController_Internal. + if (!controller) { + MTR_LOG_ERROR("Trying to perform action on node ID 0x%016llX (%llu) with a non-concrete controller", nodeID, nodeID); + MaybeDoAction(nullptr, chip::NullOptional, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); + return; + } + [controller getSessionForNode:nodeID completion:^(chip::Messaging::ExchangeManager * _Nullable exchangeManager, const chip::Optional & session, NSError * _Nullable error, NSNumber * _Nullable retryDelay) { diff --git a/src/darwin/Framework/CHIP/MTRCertificateInfo.h b/src/darwin/Framework/CHIP/MTRCertificateInfo.h index 88b64730f1..f6e67d51b1 100644 --- a/src/darwin/Framework/CHIP/MTRCertificateInfo.h +++ b/src/darwin/Framework/CHIP/MTRCertificateInfo.h @@ -68,7 +68,7 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) /** * Public key data for this certificate */ -@property (nullable, readonly, retain) NSData * publicKeyData MTR_NEWLY_AVAILABLE; +@property (nullable, readonly, retain) NSData * publicKeyData MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); @end diff --git a/src/darwin/Framework/CHIP/MTRClusterNames.h b/src/darwin/Framework/CHIP/MTRClusterNames.h index 46b5a5bfd5..5dd8b74411 100644 --- a/src/darwin/Framework/CHIP/MTRClusterNames.h +++ b/src/darwin/Framework/CHIP/MTRClusterNames.h @@ -49,7 +49,7 @@ MTR_EXTERN MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) NSSt * or '' (if the cluster ID is known but the command ID is not known) * will be returned. */ -MTR_EXTERN MTR_NEWLY_AVAILABLE NSString * MTRRequestCommandNameForID(MTRClusterIDType clusterID, MTRCommandIDType commandID); +MTR_EXTERN MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) NSString * MTRRequestCommandNameForID(MTRClusterIDType clusterID, MTRCommandIDType commandID); /** * Resolve Matter response (server to client) command IDs into a descriptive string. @@ -58,7 +58,7 @@ MTR_EXTERN MTR_NEWLY_AVAILABLE NSString * MTRRequestCommandNameForID(MTRClusterI * or '' (if the cluster ID is known but the command ID is not known) * will be returned. */ -MTR_EXTERN MTR_NEWLY_AVAILABLE NSString * MTRResponseCommandNameForID(MTRClusterIDType clusterID, MTRCommandIDType commandID); +MTR_EXTERN MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) NSString * MTRResponseCommandNameForID(MTRClusterIDType clusterID, MTRCommandIDType commandID); /** * Resolve Matter event IDs into a descriptive string. @@ -67,4 +67,4 @@ MTR_EXTERN MTR_NEWLY_AVAILABLE NSString * MTRResponseCommandNameForID(MTRCluster * or '' (if the cluster ID is known but the event ID is not known) * will be returned. */ -MTR_EXTERN MTR_NEWLY_AVAILABLE NSString * MTREventNameForID(MTRClusterIDType clusterID, MTREventIDType eventID); +MTR_EXTERN MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) NSString * MTREventNameForID(MTRClusterIDType clusterID, MTREventIDType eventID); diff --git a/src/darwin/Framework/CHIP/MTRDefines_Internal.h b/src/darwin/Framework/CHIP/MTRDefines_Internal.h index 71a03aa091..ba7d6be51d 100644 --- a/src/darwin/Framework/CHIP/MTRDefines_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDefines_Internal.h @@ -65,6 +65,11 @@ typedef struct {} variable_hidden_by_mtr_hide; // Default timed interaction timeout, in ms, if another one is not provided. #define MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS 10000 +// Useful building block for type-checking machinery. Uses C-style cast so it +// can be used in .m files as well. +#define MTR_SAFE_CAST(object, classname) \ + ([object isKindOfClass:[classname class]] ? (classname *) (object) : nil) + #pragma mark - XPC Defines #define MTR_SIMPLE_REMOTE_XPC_GETTER(XPC_CONNECTION, NAME, TYPE, DEFAULT_VALUE, GETTER_NAME, PREFIX) \ @@ -179,3 +184,15 @@ typedef struct {} variable_hidden_by_mtr_hide; #define MTR_ABSTRACT_METHOD() \ _MTR_ABSTRACT_METHOD_IMPL("%@ or some ancestor must implement %@", self.class, NSStringFromSelector(_cmd)) + +#pragma mark - Typedefs for some commonly used types. + +/** + * A data-value as defined in MTRBaseDevice.h. + */ +typedef NSDictionary * MTRDeviceDataValueDictionary; + +/** + * A response-value as defined in MTRBaseDevice.h. + */ +typedef NSDictionary * MTRDeviceResponseValueDictionary; diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRDevice.h index 5a8dcb8de0..16df47b12d 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRDevice.h @@ -16,6 +16,7 @@ */ #import +#import #import #import @@ -107,6 +108,20 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) */ @property (nonatomic, readonly, nullable, copy) NSNumber * estimatedSubscriptionLatency MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); +/** + * The Vendor Identifier associated with the device. + * + * A non-nil value if the vendor identifier has been determined from the device, nil if unknown. + */ +@property (nonatomic, readonly, nullable, copy) NSNumber * vendorID MTR_NEWLY_AVAILABLE; + +/** + * The Product Identifier associated with the device. + * + * A non-nil value if the product identifier has been determined from the device, nil if unknown. + */ +@property (nonatomic, readonly, nullable, copy) NSNumber * productID MTR_NEWLY_AVAILABLE; + /** * Set the delegate to receive asynchronous callbacks about the device. * @@ -198,7 +213,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * documentation for MTRDeviceResponseHandler. Each one will have an * MTRAttributePathKey and an MTRDataKey. */ -- (NSArray *> *)readAttributePaths:(NSArray *)attributePaths MTR_NEWLY_AVAILABLE; +- (NSArray *> *)readAttributePaths:(NSArray *)attributePaths MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); /** * Invoke a command with a designated command path @@ -323,6 +338,26 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) queue:(dispatch_queue_t)queue completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); + +/** + * Sets up the provided completion to be called when any of the following + * happens: + * + * 1) A set of attributes reaches certain values: completion called with nil. + * 2) The provided timeout expires: completion called with MTRErrorCodeTimeout error. + * 3) The wait is canceled: completion called with MTRErrorCodeCancelled error. + * + * If the MTRAttributeValueWaiter is destroyed before the + * completion is called, that is treated the same as canceling the waiter. + * + * The attributes and values to wait for are represented as a dictionary which + * has the attribute paths as keys and the expected data-values as values. + */ +- (MTRAttributeValueWaiter *)waitForAttributeValues:(NSDictionary *> *)values + timeout:(NSTimeInterval)timeout + queue:(dispatch_queue_t)queue + completion:(void (^)(NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; + @end MTR_EXTERN NSString * const MTRPreviousDataKey MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 8e37998057..7c6414d2a1 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -18,6 +18,7 @@ #import #import +#import "MTRAttributeValueWaiter_Internal.h" #import "MTRBaseClusters.h" #import "MTRBaseDevice_Internal.h" #import "MTRCluster.h" @@ -25,7 +26,7 @@ #import "MTRConversion.h" #import "MTRDefines_Internal.h" #import "MTRDeviceController_Internal.h" -#import "MTRDeviceDataValueDictionary.h" +#import "MTRDeviceDataValidation.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" #import "MTRLogging_Internal.h" @@ -97,6 +98,12 @@ - (BOOL)unitTestSuppressTimeBasedReachabilityChanges:(MTRDevice *)device; @end #endif +MTR_DIRECT_MEMBERS +@interface MTRDevice () +// nil until the first time we need it. Access guarded by our lock. +@property (nonatomic, readwrite, nullable) NSHashTable * attributeValueWaiters; +@end + @implementation MTRDevice - (instancetype)initForSubclassesWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller @@ -125,6 +132,10 @@ - (void)dealloc { // TODO: retain cycle and clean up https://github.com/project-chip/connectedhomeip/issues/34267 MTR_LOG("MTRDevice dealloc: %p", self); + + // Locking because _cancelAllAttributeValueWaiters has os_unfair_lock_assert_owner(&_lock) + std::lock_guard lock(_lock); + [self _cancelAllAttributeValueWaiters]; } + (MTRDevice *)deviceWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller @@ -229,6 +240,7 @@ - (void)invalidate std::lock_guard lock(_lock); [_delegates removeAllObjects]; + [self _cancelAllAttributeValueWaiters]; } - (BOOL)_delegateExists @@ -632,7 +644,19 @@ - (BOOL)_attributeDataValue:(MTRDeviceDataValueDictionary)observed satisfiesValu return NO; } - if (![self _attributeDataValue:observedEntry[MTRDataKey] satisfiesValueExpectation:expectedEntry[MTRDataKey]]) { + MTRDeviceDataValueDictionary observedDataValue = observedEntry[MTRDataKey]; + if (!MTR_SAFE_CAST(observedDataValue, NSDictionary)) { + MTR_LOG_ERROR("%@ observed data-value is not an NSDictionary: %@", self, observedDataValue); + return NO; + } + + MTRDeviceDataValueDictionary expectedDataValue = expectedEntry[MTRDataKey]; + if (!MTR_SAFE_CAST(expectedDataValue, NSDictionary)) { + MTR_LOG_ERROR("%@ expected data-value is not an NSDictionary: %@", self, expectedDataValue); + return NO; + } + + if (![self _attributeDataValue:observedDataValue satisfiesValueExpectation:expectedDataValue]) { return NO; } } @@ -662,7 +686,7 @@ - (BOOL)_attributeDataValue:(MTRDeviceDataValueDictionary)observed satisfiesValu } for (NSDictionary * expectedField in expectedArray) { - if (![expectedField[MTRContextTagKey] isKindOfClass:NSNumber.class] || ![expectedField[MTRDataKey] isKindOfClass:NSDictionary.class]) { + if (!MTR_SAFE_CAST(expectedField, NSDictionary) || !MTR_SAFE_CAST(expectedField[MTRContextTagKey], NSNumber) || !MTR_SAFE_CAST(expectedField[MTRDataKey], NSDictionary)) { MTR_LOG_ERROR("%@ expected structure-value contains invalid field %@", self, expectedField); return NO; } @@ -673,7 +697,7 @@ - (BOOL)_attributeDataValue:(MTRDeviceDataValueDictionary)observed satisfiesValu // pretty small arrays, so the O(N^2) behavior here is ok. BOOL found = NO; for (NSDictionary * observedField in observedArray) { - if (![observedField[MTRContextTagKey] isKindOfClass:NSNumber.class] || ![observedField[MTRDataKey] isKindOfClass:NSDictionary.class]) { + if (!MTR_SAFE_CAST(observedField, NSDictionary) || !MTR_SAFE_CAST(observedField[MTRContextTagKey], NSNumber) || !MTR_SAFE_CAST(observedField[MTRDataKey], NSDictionary)) { MTR_LOG_ERROR("%@ observed structure-value contains invalid field %@", self, observedField); return NO; } @@ -711,6 +735,127 @@ - (BOOL)_attributeDataValue:(MTRDeviceDataValueDictionary)observed satisfiesValu return YES; } +#pragma mark - Handling of waits for attribute values + +- (MTRAttributeValueWaiter *)waitForAttributeValues:(NSDictionary *)values timeout:(NSTimeInterval)timeout queue:(dispatch_queue_t)queue completion:(void (^)(NSError * _Nullable error))completion +{ + // Check whether the values coming in make sense. + for (MTRAttributePath * path in values) { + MTRVerifyArgumentOrDie(MTRDataValueDictionaryIsWellFormed(values[path]), + ([NSString stringWithFormat:@"waitForAttributeValues handed invalid data-value %@ for path %@", path, values[path]])); + } + + // Check whether we have all these values already. + NSMutableArray * requestPaths = [NSMutableArray arrayWithCapacity:values.count]; + for (MTRAttributePath * path in values) { + [requestPaths addObject:[MTRAttributeRequestPath requestPathWithEndpointID:path.endpoint clusterID:path.cluster attributeID:path.attribute]]; + } + + NSArray * currentValues = [self readAttributePaths:requestPaths]; + + std::lock_guard lock(_lock); + auto * attributeWaiter = [[MTRAttributeValueWaiter alloc] initWithDevice:self values:values queue:queue completion:completion]; + + for (MTRDeviceResponseValueDictionary currentValue in currentValues) { + // Pretend as if this got reported, for purposes of the attribute + // waiter. + [attributeWaiter _attributeValue:currentValue[MTRDataKey] reportedForPath:currentValue[MTRAttributePathKey] byDevice:self]; + } + + if (attributeWaiter.allValuesSatisfied) { + MTR_LOG("%@ waitForAttributeValues no need to wait, values already match: %@", self, values); + [attributeWaiter _notifyWithError:nil]; + return attributeWaiter; + } + + // Otherwise, wait for the values to arrive or our timeout. + if (!self.attributeValueWaiters) { + self.attributeValueWaiters = [NSHashTable weakObjectsHashTable]; + } + [self.attributeValueWaiters addObject:attributeWaiter]; + + MTR_LOG("%@ waitForAttributeValues will wait up to %f seconds for %@", self, timeout, values); + dispatch_source_t timerSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.queue); + attributeWaiter.expirationTimer = timerSource; + + // Set a timer to go off after timeout, and not repeat. + dispatch_source_set_timer(timerSource, dispatch_time(DISPATCH_TIME_NOW, static_cast(timeout * static_cast(NSEC_PER_SEC))), DISPATCH_TIME_FOREVER, + // Allow .5 seconds of leeway; should be plenty, in practice. + static_cast(0.5 * static_cast(NSEC_PER_SEC))); + + mtr_weakify(attributeWaiter); + mtr_weakify(self); + dispatch_source_set_event_handler(timerSource, ^{ + dispatch_source_cancel(timerSource); + mtr_strongify(self); + mtr_strongify(attributeWaiter); + if (self != nil && attributeWaiter != nil) { + [self _attributeWaitTimedOut:attributeWaiter]; + } + }); + + dispatch_resume(timerSource); + return attributeWaiter; +} + +- (void)_attributeValue:(MTRDeviceDataValueDictionary)value reportedForPath:(MTRAttributePath *)path +{ + os_unfair_lock_assert_owner(&_lock); + + // Check whether anyone was waiting for this attribute. + NSMutableArray * satisfiedWaiters; + for (MTRAttributeValueWaiter * attributeValueWaiter in self.attributeValueWaiters) { + if ([attributeValueWaiter _attributeValue:value reportedForPath:path byDevice:self] && attributeValueWaiter.allValuesSatisfied) { + if (!satisfiedWaiters) { + satisfiedWaiters = [NSMutableArray array]; + } + [satisfiedWaiters addObject:attributeValueWaiter]; + } + } + + for (MTRAttributeValueWaiter * attributeValueWaiter in satisfiedWaiters) { + [self _notifyAttributeValueWaiter:attributeValueWaiter withError:nil]; + } +} + +- (void)_attributeWaitTimedOut:(MTRAttributeValueWaiter *)attributeValueWaiter +{ + std::lock_guard lock(_lock); + [self _notifyAttributeValueWaiter:attributeValueWaiter withError:[MTRError errorForCHIPErrorCode:CHIP_ERROR_TIMEOUT]]; +} + +- (void)_attributeWaitCanceled:(MTRAttributeValueWaiter *)attributeValueWaiter +{ + std::lock_guard lock(_lock); + [self _doAttributeWaitCanceled:attributeValueWaiter]; +} + +- (void)_doAttributeWaitCanceled:(MTRAttributeValueWaiter *)attributeValueWaiter +{ + os_unfair_lock_assert_owner(&_lock); + + [self _notifyAttributeValueWaiter:attributeValueWaiter withError:[MTRError errorForCHIPErrorCode:CHIP_ERROR_CANCELLED]]; +} + +- (void)_notifyAttributeValueWaiter:(MTRAttributeValueWaiter *)attributeValueWaiter withError:(NSError * _Nullable)error +{ + os_unfair_lock_assert_owner(&_lock); + + [self.attributeValueWaiters removeObject:attributeValueWaiter]; + [attributeValueWaiter _notifyWithError:error]; +} + +- (void)_cancelAllAttributeValueWaiters +{ + os_unfair_lock_assert_owner(&_lock); + + auto * attributeValueWaiters = self.attributeValueWaiters; + self.attributeValueWaiters = nil; + for (MTRAttributeValueWaiter * attributeValueWaiter in attributeValueWaiters) { + [self _doAttributeWaitCanceled:attributeValueWaiter]; + } +} + @end /* BEGIN DRAGONS: Note methods here cannot be renamed, and are used by private callers, do not rename, remove or modify behavior here */ diff --git a/src/darwin/Framework/CHIP/MTRDeviceClusterData.h b/src/darwin/Framework/CHIP/MTRDeviceClusterData.h index d34ada90e9..2abdc6113b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceClusterData.h +++ b/src/darwin/Framework/CHIP/MTRDeviceClusterData.h @@ -17,7 +17,6 @@ #import #import "MTRDefines_Internal.h" -#import "MTRDeviceDataValueDictionary.h" NS_ASSUME_NONNULL_BEGIN diff --git a/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm b/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm index 6a9ac601d4..530d608fd6 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceConnectivityMonitor.mm @@ -120,6 +120,10 @@ - (void)handleResolvedHostname:(const char *)hostName port:(uint16_t)port error: { std::lock_guard lock(sConnectivityMonitorLock); + if (hostName == NULL) { + MTR_LOG_ERROR("%@ NULL host resolved, ignoring", self); + return; + } // dns_sd.h: must check and call deallocate if error is kDNSServiceErr_ServiceNotRunning if (error == kDNSServiceErr_ServiceNotRunning) { MTR_LOG_ERROR("%@ disconnected from dns-sd subsystem", self); diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index 0b553c9d43..35a20c1ab4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -68,7 +68,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * If true, the controller has been suspended via `suspend` and not resumed yet. */ -@property (readonly, nonatomic, getter=isSuspended) BOOL suspended MTR_NEWLY_AVAILABLE; +@property (readonly, nonatomic, getter=isSuspended) BOOL suspended MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); /** * The ID assigned to this controller at creation time. @@ -210,14 +210,14 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * @param[in] queue The queue on which the callbacks will be delivered */ - (void)addDeviceControllerDelegate:(id)delegate - queue:(dispatch_queue_t)queue MTR_NEWLY_AVAILABLE; + queue:(dispatch_queue_t)queue MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); /** * Removes a Delegate from the device controller * * @param[in] delegate The delegate to be removed */ -- (void)removeDeviceControllerDelegate:(id)delegate MTR_NEWLY_AVAILABLE; +- (void)removeDeviceControllerDelegate:(id)delegate MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); /** * Start scanning for commissionable devices. @@ -289,7 +289,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * * Suspending an already-suspended controller has no effect. */ -- (void)suspend MTR_NEWLY_AVAILABLE; +- (void)suspend MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); /** * Resume the controller. This has no effect if the controller is not @@ -298,7 +298,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * A resume following any number of suspend calls will resume the controller; * there does not need to be a resume call to match every suspend call. */ -- (void)resume MTR_NEWLY_AVAILABLE; +- (void)resume MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); /** * Shut down the controller. Calls to shutdown after the first one are NO-OPs. diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 5695ef23c7..5cee77cb66 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -14,20 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#import #import #import #import "MTRDeviceController_Internal.h" #import "MTRAsyncWorkQueue.h" -#import "MTRAttestationTrustStoreBridge.h" #import "MTRBaseDevice_Internal.h" -#import "MTRCommissionableBrowser.h" -#import "MTRCommissionableBrowserResult_Internal.h" #import "MTRCommissioningParameters.h" #import "MTRConversion.h" #import "MTRDefines_Internal.h" -#import "MTRDeviceControllerDelegateBridge.h" #import "MTRDeviceControllerFactory_Internal.h" #import "MTRDeviceControllerLocalTestStorage.h" #import "MTRDeviceControllerStartupParams.h" @@ -43,51 +40,23 @@ #import "MTRLogging_Internal.h" #import "MTRMetricKeys.h" #import "MTRMetricsCollector.h" -#import "MTRP256KeypairBridge.h" #import "MTRPersistentStorageDelegateBridge.h" -#import "MTRServerEndpoint_Internal.h" #import "MTRSetupPayload.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" #import "MTRUtilities.h" #import "NSDataSpanConversion.h" #import "NSStringSpanConversion.h" -#import -#import -#import -#import "MTRDeviceAttestationDelegateBridge.h" -#import "MTRDeviceConnectionBridge.h" - -#include - -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include -#include #include #import -// TODO: These strings and their consumers in this file should probably go away, -// since none of them really apply to all controllers. -static NSString * const kErrorNotRunning = @"Controller is not running. Call startup first."; static NSString * const kErrorSpake2pVerifierGenerationFailed = @"PASE verifier generation failed"; static NSString * const kErrorSpake2pVerifierSerializationFailed = @"PASE verifier serialization failed"; @@ -119,22 +88,7 @@ - (instancetype)initWithDelegate:(id)delegate queue @end @implementation MTRDeviceController { - chip::Credentials::PartialDACVerifier * _partialDACVerifier; - chip::Credentials::DefaultDACVerifier * _defaultDACVerifier; - MTRDeviceControllerDelegateBridge * _deviceControllerDelegateBridge; - MTRDeviceAttestationDelegateBridge * _deviceAttestationDelegateBridge; os_unfair_lock _underlyingDeviceMapLock; - MTRCommissionableBrowser * _commissionableBrowser; - MTRAttestationTrustStoreBridge * _attestationTrustStoreBridge; - - // _serverEndpoints is only touched on the Matter queue. - NSMutableArray * _serverEndpoints; - - MTRDeviceStorageBehaviorConfiguration * _storageBehaviorConfiguration; - std::atomic _storedFabricIndex; - std::atomic> _storedCompressedFabricID; - MTRP256KeypairBridge _signingKeypairBridge; - MTRP256KeypairBridge _operationalKeypairBridge; // For now, we just ensure that access to _suspended is atomic, but don't // guarantee atomicity of the the entire suspend/resume operation. The @@ -516,37 +470,6 @@ + (BOOL)checkForError:(CHIP_ERROR)errorCode logMsg:(NSString *)logMsg error:(NSE return YES; } -- (BOOL)checkIsRunning -{ - return [self checkIsRunning:nil]; -} - -- (BOOL)checkIsRunning:(NSError * __autoreleasing *)error -{ - if ([self isRunning]) { - return YES; - } - - MTR_LOG_ERROR("%@: %@ Error: %s", NSStringFromClass(self.class), self, [kErrorNotRunning UTF8String]); - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - - return NO; -} - -- (void)getSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion -{ - MTR_ABSTRACT_METHOD(); - completion(nullptr, chip::NullOptional, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); -} - -- (void)getSessionForCommissioneeDevice:(chip::NodeId)deviceID completion:(MTRInternalDeviceConnectionCallback)completion -{ - MTR_ABSTRACT_METHOD(); - completion(nullptr, chip::NullOptional, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); -} - - (void)asyncDispatchToMatterQueue:(dispatch_block_t)block errorHandler:(nullable MTRDeviceErrorHandler)errorHandler { // TODO: Figure out how to get callsites to have an MTRDeviceController_Concrete. @@ -554,49 +477,10 @@ - (void)asyncDispatchToMatterQueue:(dispatch_block_t)block errorHandler:(nullabl errorHandler([MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); } -- (void)syncRunOnWorkQueue:(SyncWorkQueueBlock)block error:(NSError * __autoreleasing *)error -{ - VerifyOrDie(!chip::DeviceLayer::PlatformMgrImpl().IsWorkQueueCurrentQueue()); - VerifyOrReturn([self checkIsRunning:error]); - - dispatch_sync(_chipWorkQueue, ^{ - VerifyOrReturn([self checkIsRunning:error]); - block(); - }); -} - -- (id)syncRunOnWorkQueueWithReturnValue:(SyncWorkQueueBlockWithReturnValue)block error:(NSError * __autoreleasing *)error -{ - __block id rv = nil; - auto adapter = ^{ - rv = block(); - }; - - [self syncRunOnWorkQueue:adapter error:error]; - - return rv; -} - -- (BOOL)syncRunOnWorkQueueWithBoolReturnValue:(SyncWorkQueueBlockWithBoolReturnValue)block error:(NSError * __autoreleasing *)error -{ - __block BOOL success = NO; - auto adapter = ^{ - success = block(); - }; - [self syncRunOnWorkQueue:adapter error:error]; - - return success; -} - -- (chip::FabricIndex)fabricIndex -{ - return _storedFabricIndex; -} - - (nullable NSNumber *)compressedFabricID { - auto storedValue = _storedCompressedFabricID.load(); - return storedValue.has_value() ? @(storedValue.value()) : nil; + MTR_ABSTRACT_METHOD(); + return nil; } #ifdef DEBUG @@ -714,7 +598,7 @@ - (NSUInteger)_iterateDelegateInfoWithBlock:(void (^_Nullable)(MTRDeviceControll } } -- (void)_callDelegatesWithBlock:(void (^_Nullable)(id delegate))block logString:(const char *)logString; +- (void)_callDelegatesWithBlock:(void (^_Nullable)(id delegate))block logString:(const char *)logString { NSUInteger delegatesCalled = [self _iterateDelegateInfoWithBlock:^(MTRDeviceControllerDelegateInfo * delegateInfo) { id strongDelegate = delegateInfo.delegate; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h index 374b8aec20..bd575e5a42 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDelegate.h @@ -112,7 +112,7 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) * the controller will be in the specified state. */ - (void)controller:(MTRDeviceController *)controller - suspendedChangedTo:(BOOL)suspended MTR_NEWLY_AVAILABLE; + suspendedChangedTo:(BOOL)suspended MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); @end typedef NS_ENUM(NSUInteger, MTRPairingStatus) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h index c18a49ba3a..8ba1ae7dff 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h @@ -153,11 +153,11 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) /** * The root certificate we were initialized with. */ -@property (nonatomic, copy, readonly) MTRCertificateDERBytes rootCertificate MTR_NEWLY_AVAILABLE; +@property (nonatomic, copy, readonly) MTRCertificateDERBytes rootCertificate MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); @end -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @interface MTRXPCDeviceControllerParameters : MTRDeviceControllerAbstractParameters - (instancetype)init NS_UNAVAILABLE; @@ -174,8 +174,8 @@ MTR_NEWLY_AVAILABLE - (instancetype)initWithXPConnectionBlock:(NSXPCConnection * (^)(void) )xpcConnectionBlock uniqueIdentifier:(NSUUID *)uniqueIdentifier; -@property (atomic, readonly, retain) NSUUID * uniqueIdentifier MTR_NEWLY_AVAILABLE; -@property (readonly, strong, nonatomic) NSXPCConnection * (^xpcConnectionBlock)(void) MTR_NEWLY_AVAILABLE; +@property (atomic, readonly, retain) NSUUID * uniqueIdentifier MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); +@property (readonly, strong, nonatomic) NSXPCConnection * (^xpcConnectionBlock)(void) MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); @end diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm index 6a64b6ee84..e3d3ad1de4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm @@ -18,6 +18,7 @@ #import "MTRCertificates.h" #import "MTRConversion.h" #import "MTRDeviceControllerStartupParams_Internal.h" +#import "MTRDeviceController_Concrete.h" #import "MTRDeviceController_Internal.h" #import "MTRLogging_Internal.h" #import "MTRP256KeypairBridge.h" @@ -596,7 +597,7 @@ - (instancetype)initForExistingFabric:(FabricTable *)fabricTable return self; } -- (instancetype)initForNewController:(MTRDeviceController *)controller +- (instancetype)initForNewController:(MTRDeviceController_Concrete *)controller fabricTable:(chip::FabricTable *)fabricTable keystore:(chip::Crypto::OperationalKeystore *)keystore advertiseOperational:(BOOL)advertiseOperational diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h index 0b4065f491..35ed52a3a6 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h @@ -26,6 +26,9 @@ #include #include +// MTRDeviceController_Concrete.h imports this header, so we can't import it. +@class MTRDeviceController_Concrete; + namespace chip { class FabricTable; @@ -157,7 +160,7 @@ NS_ASSUME_NONNULL_BEGIN /** * Initialize for controller bringup with per-controller storage. */ -- (instancetype)initForNewController:(MTRDeviceController *)controller +- (instancetype)initForNewController:(MTRDeviceController_Concrete *)controller fabricTable:(chip::FabricTable *)fabricTable keystore:(chip::Crypto::OperationalKeystore *)keystore advertiseOperational:(BOOL)advertiseOperational diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h index 0cfb25f494..606d430847 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h @@ -26,7 +26,9 @@ #import #import +#import "MTRAsyncWorkQueue.h" #import "MTRDeviceConnectionBridge.h" +#import "MTRDeviceControllerDataStore.h" #import "MTRDeviceControllerStartupParams_Internal.h" #include @@ -120,6 +122,23 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)clearPendingShutdown; +/** + * Ensure we have a CASE session to the given node ID and then call the provided + * connection callback. This may be called on any queue (including the Matter + * event queue) and on success will always call the provided connection callback + * on the Matter queue, asynchronously. Consumers must be prepared to run on + * the Matter queue (an in particular must not use any APIs that will try to do + * sync dispatch to the Matter queue). + * + * If the controller is not running when this function is called, it will + * synchronously invoke the completion with an error, on whatever queue + * getSessionForNode was called on. + * + * If the controller is not running when the async dispatch on the Matter queue + * happens, the completion will be invoked with an error on the Matter queue. + */ +- (void)getSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion; + /** * Since getSessionForNode now enqueues by the subscription pool for Thread * devices, MTRDevice_Concrete needs a direct non-queued access because it already @@ -127,6 +146,23 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)directlyGetSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion; +/** + * Get a session for the commissionee device with the given device id. This may + * be called on any queue (including the Matter event queue) and on success will + * always call the provided connection callback on the Matter queue, + * asynchronously. Consumers must be prepared to run on the Matter queue (an in + * particular must not use any APIs that will try to do sync dispatch to the + * Matter queue). + * + * If the controller is not running when this function is called, it will + * synchronously invoke the completion with an error, on whatever queue + * getSessionForCommissioneeDevice was called on. + * + * If the controller is not running when the async dispatch on the Matter queue + * happens, the completion will be invoked with an error on the Matter queue. + */ +- (void)getSessionForCommissioneeDevice:(chip::NodeId)deviceID completion:(MTRInternalDeviceConnectionCallback)completion; + /** * Notify the controller that a new operational instance with the given node id * and a compressed fabric id that matches this controller has been observed. @@ -187,6 +223,22 @@ NS_ASSUME_NONNULL_BEGIN queue:(dispatch_queue_t)queue completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion; +/** + * Will return chip::kUndefinedFabricIndex if we do not have a fabric index. + */ +@property (readonly) chip::FabricIndex fabricIndex; + +/** + * A queue with a fixed width that allows a number of MTRDevice objects to perform + * subscription at the same time. + */ +@property (nonatomic, readonly) MTRAsyncWorkQueue * concurrentSubscriptionPool; + +/** + * The per-controller data store this controller was initialized with, if any. + */ +@property (nonatomic, readonly, nullable) MTRDeviceControllerDataStore * controllerDataStore; + @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm index 1a164e50b1..4dfffcbb89 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm @@ -106,8 +106,6 @@ @interface MTRDeviceController_Concrete () @property (nonatomic, readonly, nullable) MTRAttestationTrustStoreBridge * attestationTrustStoreBridge; @property (nonatomic, readonly, nullable) NSMutableArray * serverEndpoints; -@property (nonatomic, readonly) MTRAsyncWorkQueue * concurrentSubscriptionPool; - @property (nonatomic, readonly) MTRDeviceStorageBehaviorConfiguration * storageBehaviorConfiguration; // Whether we should be advertising our operational identity when we are not suspended. diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h index c26518d532..8fc93b6235 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h @@ -25,41 +25,25 @@ #import "MTRDeviceConnectionBridge.h" // For MTRInternalDeviceConnectionCallback #import "MTRDeviceController.h" -#include -#include - #import #import "MTRBaseDevice.h" #import "MTRDeviceClusterData.h" #import "MTRDeviceController.h" -#import "MTRDeviceControllerDataStore.h" #import "MTRDeviceControllerDelegate.h" #import "MTRDeviceStorageBehaviorConfiguration.h" -#import - #import #import -#import #import @class MTRDeviceControllerParameters; @class MTRDeviceControllerFactory; @class MTRDevice; -@class MTRAsyncWorkQueue; @protocol MTRDevicePairingDelegate; @protocol MTRDeviceControllerDelegate; @class MTRDevice_Concrete; -namespace chip { -class FabricTable; - -namespace Controller { - class DeviceCommissioner; -} -} // namespace chip - NS_ASSUME_NONNULL_BEGIN @interface MTRDeviceController () @@ -68,31 +52,18 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly, assign) os_unfair_lock_t deviceMapLock; @property (readwrite, nonatomic) NSUUID * uniqueIdentifier; - -// queue used to serialize all work performed by the MTRDeviceController // (moved here so subclasses can initialize differently) -@property (readwrite, retain) dispatch_queue_t chipWorkQueue; - (instancetype)initForSubclasses:(BOOL)startSuspended; #pragma mark - MTRDeviceControllerFactory methods -/** - * Will return chip::kUndefinedFabricIndex if we do not have a fabric index. - */ -@property (readonly) chip::FabricIndex fabricIndex; - /** * Will return the compressed fabric id of the fabric if the controller is * running, else nil. */ @property (nonatomic, readonly, nullable) NSNumber * compressedFabricID; -/** - * The per-controller data store this controller was initialized with, if any. - */ -@property (nonatomic, readonly, nullable) MTRDeviceControllerDataStore * controllerDataStore; - /** * OTA delegate and its queue, if this controller supports OTA. Either both * will be non-nil or both will be nil. @@ -100,12 +71,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, nullable) id otaProviderDelegate; @property (nonatomic, readonly, nullable) dispatch_queue_t otaProviderDelegateQueue; -/** - * A queue with a fixed width that allows a number of MTRDevice objects to perform - * subscription at the same time. - */ -@property (nonatomic, readonly) MTRAsyncWorkQueue * concurrentSubscriptionPool; - /** * Fabric ID tied to controller */ @@ -121,40 +86,6 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, retain, nullable) NSData * rootPublicKey; -/** - * Ensure we have a CASE session to the given node ID and then call the provided - * connection callback. This may be called on any queue (including the Matter - * event queue) and on success will always call the provided connection callback - * on the Matter queue, asynchronously. Consumers must be prepared to run on - * the Matter queue (an in particular must not use any APIs that will try to do - * sync dispatch to the Matter queue). - * - * If the controller is not running when this function is called, it will - * synchronously invoke the completion with an error, on whatever queue - * getSessionForNode was called on. - * - * If the controller is not running when the async dispatch on the Matter queue - * happens, the completion will be invoked with an error on the Matter queue. - */ -- (void)getSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion; - -/** - * Get a session for the commissionee device with the given device id. This may - * be called on any queue (including the Matter event queue) and on success will - * always call the provided connection callback on the Matter queue, - * asynchronously. Consumers must be prepared to run on the Matter queue (an in - * particular must not use any APIs that will try to do sync dispatch to the - * Matter queue). - * - * If the controller is not running when this function is called, it will - * synchronously invoke the completion with an error, on whatever queue - * getSessionForCommissioneeDevice was called on. - * - * If the controller is not running when the async dispatch on the Matter queue - * happens, the completion will be invoked with an error on the Matter queue. - */ -- (void)getSessionForCommissioneeDevice:(chip::NodeId)deviceID completion:(MTRInternalDeviceConnectionCallback)completion; - /** * Try to asynchronously dispatch the given block on the Matter queue. If the * controller is not running either at call time or when the block would be diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index 7e88870aa7..9b9a87bb97 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -20,6 +20,7 @@ #import "MTRDeviceController_Internal.h" #import "MTRDevice_XPC.h" #import "MTRDevice_XPC_Internal.h" +#import "MTRError_Internal.h" #import "MTRLogging_Internal.h" #import "MTRXPCClientProtocol.h" #import "MTRXPCServerProtocol.h" @@ -37,12 +38,17 @@ @interface MTRDeviceController_XPC () @property (nonnull, atomic, readwrite, retain) MTRXPCDeviceControllerParameters * xpcParameters; @property (atomic, readwrite, assign) NSTimeInterval xpcRetryTimeInterval; @property (atomic, readwrite, assign) BOOL xpcConnectedOrConnecting; +@property (nonatomic, readonly, retain) dispatch_queue_t workQueue; @end NSString * const MTRDeviceControllerRegistrationControllerContextKey = @"MTRDeviceControllerRegistrationControllerContext"; NSString * const MTRDeviceControllerRegistrationNodeIDsKey = @"MTRDeviceControllerRegistrationNodeIDs"; NSString * const MTRDeviceControllerRegistrationNodeIDKey = @"MTRDeviceControllerRegistrationNodeID"; +NSString * const MTRDeviceControllerRegistrationControllerNodeIDKey = @"MTRDeviceControllerRegistrationControllerNodeID"; +NSString * const MTRDeviceControllerRegistrationControllerIsRunningKey = @"MTRDeviceControllerRegistrationControllerIsRunning"; +NSString * const MTRDeviceControllerRegistrationDeviceInternalStateKey = @"MTRDeviceControllerRegistrationDeviceInternalState"; +NSString * const MTRDeviceControllerRegistrationControllerCompressedFabricIDKey = @"MTRDeviceControllerRegistrationControllerCompressedFabricID"; // #define MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR @@ -90,6 +96,9 @@ - (void)removeDevice:(MTRDevice *)device } #pragma mark - XPC +@synthesize controllerNodeID = _controllerNodeID; +@synthesize compressedFabricID = _compressedFabricID; + + (NSMutableSet *)_allowedClasses { static NSArray * sBaseAllowedClasses = @[ @@ -167,6 +176,13 @@ - (NSXPCInterface *)_interfaceForClientProtocol argumentIndex:1 ofReply:NO]; + allowedClasses = [MTRDeviceController_XPC _allowedClasses]; + + [interface setClasses:allowedClasses + forSelector:@selector(controller:controllerConfigurationUpdated:) + argumentIndex:1 + ofReply:NO]; + return interface; } @@ -182,7 +198,7 @@ - (void)_startXPCConnectionRetry self.xpcRetryTimeInterval = 0.5; mtr_weakify(self); - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (self.xpcRetryTimeInterval * NSEC_PER_SEC)), self.chipWorkQueue, ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (self.xpcRetryTimeInterval * NSEC_PER_SEC)), self.workQueue, ^{ mtr_strongify(self); [self _xpcConnectionRetry]; }); @@ -202,7 +218,7 @@ - (void)_xpcConnectionRetry self.xpcRetryTimeInterval = MIN(60.0, self.xpcRetryTimeInterval); mtr_weakify(self); - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.xpcRetryTimeInterval * NSEC_PER_SEC)), self.chipWorkQueue, ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.xpcRetryTimeInterval * NSEC_PER_SEC)), self.workQueue, ^{ mtr_strongify(self); [self _xpcConnectionRetry]; }); @@ -290,7 +306,7 @@ - (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParamete self.uniqueIdentifier = UUID; self.xpcParameters = xpcParameters; - self.chipWorkQueue = dispatch_queue_create("MTRDeviceController_XPC_queue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + _workQueue = dispatch_queue_create("MTRDeviceController_XPC_queue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); if (![self _setupXPCConnection]) { return nil; @@ -346,9 +362,6 @@ - (MTRDevice *)_setupDeviceForNodeID:(NSNumber *)nodeID prefetchedClusterData:(N #pragma mark - XPC Action Overrides -MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(isRunning, BOOL, NO, getIsRunningWithReply) -MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(controllerNodeID, NSNumber *, nil, controllerNodeIDWithReply) - // Not Supported via XPC // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserResult *)discoveredDevice payload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; @@ -424,6 +437,67 @@ - (oneway void)device:(NSNumber *)nodeID internalStateUpdated:(NSDictionary *)di #pragma mark - MTRDeviceController Protocol Client +- (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(NSDictionary *)configuration +{ + // Reuse the same format as config dictionary, and add values for internal states + // @{ + // MTRDeviceControllerRegistrationControllerContextKey: @{ + // MTRDeviceControllerRegistrationControllerNodeIDKey: controllerNodeID + // } + // MTRDeviceControllerRegistrationNodeIDsKey: @[ + // @{ + // MTRDeviceControllerRegistrationNodeIDKey: nodeID, + // MTRDeviceControllerRegistrationDeviceInternalStateKey: deviceInternalStateDictionary + // } + // ] + // } + + NSDictionary * controllerContext = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationControllerContextKey], NSDictionary); + if (controllerContext) { + NSNumber * controllerNodeID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey], NSNumber); + if (controllerNodeID) { + _controllerNodeID = controllerNodeID; + } + + NSNumber * compressedFabricID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerCompressedFabricIDKey], NSNumber); + if (compressedFabricID) { + _compressedFabricID = compressedFabricID; + } + } + + NSArray * deviceInfoList = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationNodeIDsKey], NSArray); + + MTR_LOG("Received controllerConfigurationUpdated: controllerNodeID %@ compressedFabricID %016lluX deviceInfoList %@", self.controllerNodeID, self.compressedFabricID.unsignedLongLongValue, deviceInfoList); + + for (NSDictionary * deviceInfo in deviceInfoList) { + if (!MTR_SAFE_CAST(deviceInfo, NSDictionary)) { + MTR_LOG_ERROR(" - Missing or malformed device Info"); + continue; + } + + NSNumber * nodeID = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationNodeIDKey], NSNumber); + if (!nodeID) { + MTR_LOG_ERROR(" - Missing or malformed nodeID"); + continue; + } + + NSDictionary * deviceInternalState = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationDeviceInternalStateKey], NSDictionary); + if (!deviceInternalState) { + MTR_LOG_ERROR(" - Missing or malformed deviceInternalState"); + continue; + } + + auto * device = static_cast([self deviceForNodeID:nodeID]); + [device device:nodeID internalStateUpdated:deviceInternalState]; + } +} + +- (BOOL)isRunning +{ + // For XPC controller, always return yes + return YES; +} + // Not Supported via XPC //- (oneway void)controller:(NSUUID *)controller statusUpdate:(MTRCommissioningStatus)status { // } diff --git a/src/darwin/Framework/CHIP/MTRDeviceDataValidation.h b/src/darwin/Framework/CHIP/MTRDeviceDataValidation.h new file mode 100644 index 0000000000..5d448d8aa4 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceDataValidation.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "MTRDefines_Internal.h" + +NS_ASSUME_NONNULL_BEGIN + +// Returns whether a data-value dictionary is well-formed (in the sense that all +// the types of the objects inside are as expected, so it's actually a valid +// representation of some TLV). Implemented in MTRBaseDevice.mm because that's +// where the pieces needed to implement it are, but declared here so our tests +// can see it. +MTR_EXTERN MTR_TESTABLE BOOL MTRDataValueDictionaryIsWellFormed(MTRDeviceDataValueDictionary value); + +// Returns whether the provided attribute report actually has the right sorts of +// objects in the right places. +MTR_EXTERN MTR_TESTABLE BOOL MTRAttributeReportIsWellFormed(NSArray * report); + +// Returns whether the provided event report actually has the right sorts of +// objects in the right places. +MTR_EXTERN MTR_TESTABLE BOOL MTREventReportIsWellFormed(NSArray * report); + +// Returns whether the provided invoke response actually has the right sorts of +// objects in the right places. +MTR_EXTERN MTR_TESTABLE BOOL MTRInvokeResponseIsWellFormed(NSArray * response); + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceDataValidation.mm b/src/darwin/Framework/CHIP/MTRDeviceDataValidation.mm new file mode 100644 index 0000000000..cd4ebabf81 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceDataValidation.mm @@ -0,0 +1,216 @@ +/** + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "MTRDeviceDataValidation.h" + +#import "MTRBaseDevice.h" + +#import "MTRLogging_Internal.h" + +// MTRDataValueDictionaryIsWellFormed lives in MTRBaseDevice.mm, because it uses +// static functions defined in that file. + +#pragma mark - Helpers used by multiple validators + +#define MTR_CHECK_CLASS(className) \ + ^(className * arg) { return MTR_SAFE_CAST(arg, className) != nil; } + +// input is not known to be an NSDictionary yet on entry. +// +// expectedShape maps keys to value validator blocks. +static BOOL MTRDictionaryHasExpectedShape(NSDictionary * input, NSDictionary * expectedShape) +{ + if (!MTR_SAFE_CAST(input, NSDictionary)) { + return NO; + } + + for (id key in expectedShape) { + id value = input[key]; + if (!value) { + return NO; + } + auto validator = static_cast(expectedShape[key]); + if (!validator(value)) { + return NO; + } + } + + return YES; +} + +#pragma mark - Attribute report validation + +static const auto sAttributeDataShape = @{ + MTRAttributePathKey : MTR_CHECK_CLASS(MTRAttributePath), + MTRDataKey : (^(MTRDeviceDataValueDictionary arg) { + return MTRDataValueDictionaryIsWellFormed(arg); + }), +}; + +static const auto sAttributeErrorShape = @{ + MTRAttributePathKey : MTR_CHECK_CLASS(MTRAttributePath), + MTRErrorKey : MTR_CHECK_CLASS(NSError), +}; + +BOOL MTRAttributeReportIsWellFormed(NSArray * report) +{ + if (!MTR_SAFE_CAST(report, NSArray)) { + MTR_LOG_ERROR("Attribute report is not an array: %@", report); + return NO; + } + + for (MTRDeviceResponseValueDictionary item in report) { + // item can be a value report or an error report. + if (!MTRDictionaryHasExpectedShape(item, sAttributeDataShape) && !MTRDictionaryHasExpectedShape(item, sAttributeErrorShape)) { + MTR_LOG_ERROR("Attribute report contains a weird entry: %@", item); + return NO; + } + + // Now we know item is in fact a dictionary, and it has at least one of MTRDataKey and MTRErrorKey. Make sure it's + // not claiming both, which could confuse code that examines it. + if (item[MTRDataKey] != nil && item[MTRErrorKey] != nil) { + MTR_LOG_ERROR("Attribute report contains an entry that claims to be both data and error: %@", item); + return NO; + } + } + + return YES; +} + +#pragma mark - Event report validation + +// MTREventIsHistoricalKey is claimed to be present no matter what, as +// long as MTREventPathKey is present. +static const auto sEventDataShape = @{ + MTREventPathKey : MTR_CHECK_CLASS(MTREventPath), + MTRDataKey : (^(MTRDeviceDataValueDictionary arg) { + return MTRDataValueDictionaryIsWellFormed(arg); + }), + MTREventIsHistoricalKey : MTR_CHECK_CLASS(NSNumber), + MTREventNumberKey : MTR_CHECK_CLASS(NSNumber), + MTREventPriorityKey : MTR_CHECK_CLASS(NSNumber), + MTREventTimeTypeKey : MTR_CHECK_CLASS(NSNumber), +}; + +static const auto sEventErrorShape = @{ + MTREventPathKey : MTR_CHECK_CLASS(MTREventPath), + MTRErrorKey : MTR_CHECK_CLASS(NSError), + MTREventIsHistoricalKey : MTR_CHECK_CLASS(NSNumber), +}; + +BOOL MTREventReportIsWellFormed(NSArray * report) +{ + if (!MTR_SAFE_CAST(report, NSArray)) { + MTR_LOG_ERROR("Event report is not an array: %@", report); + return NO; + } + + for (MTRDeviceResponseValueDictionary item in report) { + // item can be a value report or an error report. + if (!MTRDictionaryHasExpectedShape(item, sEventDataShape) && !MTRDictionaryHasExpectedShape(item, sEventErrorShape)) { + MTR_LOG_ERROR("Event report contains a weird entry: %@", item); + return NO; + } + + // Now we know item is in fact a dictionary, and it has at least one of MTRDataKey and MTRErrorKey. Make sure it's + // not claiming both, which could confuse code that examines it. + if (item[MTRDataKey] != nil && item[MTRErrorKey] != nil) { + MTR_LOG_ERROR("Event report contains an entry that claims to be both data and error: %@", item); + return NO; + } + + if (item[MTRDataKey]) { + // Check well-formedness of our timestamps. Note that we have + // already validated the type of item[MTREventTimeTypeKey]. + uint64_t eventTimeType = [item[MTREventTimeTypeKey] unsignedLongLongValue]; + switch (eventTimeType) { + case MTREventTimeTypeSystemUpTime: { + if (!MTR_SAFE_CAST(item[MTREventSystemUpTimeKey], NSNumber)) { + MTR_LOG_ERROR("Event report claims system uptime timing but does not have the time: %@", item); + return NO; + } + break; + } + case MTREventTimeTypeTimestampDate: { + if (!MTR_SAFE_CAST(item[MTREventTimestampDateKey], NSDate)) { + MTR_LOG_ERROR("Event report claims epoch timing but does not have the time: %@", item); + return NO; + } + break; + } + default: + MTR_LOG_ERROR("Uknown time type for event report: %@", item); + return NO; + } + } + } + + return YES; +} + +#pragma mark - Invoke response validation + +BOOL MTRInvokeResponseIsWellFormed(NSArray * response) +{ + if (!MTR_SAFE_CAST(response, NSArray)) { + MTR_LOG_ERROR("Invoke response is not an array: %@", response); + return NO; + } + + // Input is an array with a single value that must have MTRCommandPathKey. + if (response.count != 1) { + MTR_LOG_ERROR("Invoke response is not an array with exactly one entry: %@", response); + return NO; + } + + MTRDeviceResponseValueDictionary responseValue = response[0]; + + if (!MTR_SAFE_CAST(responseValue, NSDictionary) || !MTR_SAFE_CAST(responseValue[MTRCommandPathKey], MTRCommandPath)) { + MTR_LOG_ERROR("Invoke response is not an array with the right things in it: %@", response); + return NO; + } + + MTRDeviceDataValueDictionary _Nullable data = responseValue[MTRDataKey]; + NSError * _Nullable error = responseValue[MTRErrorKey]; + + if (data != nil && error != nil) { + MTR_LOG_ERROR("Invoke response claims to have both data and error: %@", responseValue); + return NO; + } + + if (error != nil) { + return MTR_SAFE_CAST(error, NSError) != nil; + } + + if (data == nil) { + // This is valid: indicates a success status response. + return YES; + } + + if (!MTRDataValueDictionaryIsWellFormed(data)) { + MTR_LOG_ERROR("Invoke response claims to have data that is not a data-value: %@", data); + return NO; + } + + // Now we know data is a dictionary (in fact a data-value). The only thing + // we promise about it is that it has type MTRStructureValueType. + if (![MTRStructureValueType isEqual:data[MTRTypeKey]]) { + MTR_LOG_ERROR("Invoke response data is not of structure type: %@", data); + return NO; + } + + return YES; +} diff --git a/src/darwin/Framework/CHIP/MTRDeviceType.h b/src/darwin/Framework/CHIP/MTRDeviceType.h index aded23e7af..0330b76d15 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceType.h +++ b/src/darwin/Framework/CHIP/MTRDeviceType.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @interface MTRDeviceType : NSObject /** diff --git a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm index 2423e4e876..091d50a5d8 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm @@ -31,7 +31,7 @@ #import "MTRDeviceConnectivityMonitor.h" #import "MTRDeviceControllerOverXPC.h" #import "MTRDeviceController_Internal.h" -#import "MTRDeviceDataValueDictionary.h" +#import "MTRDeviceDataValidation.h" #import "MTRDevice_Concrete.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" @@ -71,6 +71,9 @@ @interface MTRDevice_Concrete () @property (nonatomic, readwrite, nullable, copy) NSNumber * estimatedSubscriptionLatency; @property (nonatomic, readwrite, assign) BOOL suspended; +// nullable because technically _deviceController is nullable. +@property (nonatomic, readonly, nullable) MTRDeviceController_Concrete * _concreteController; + @end typedef void (^MTRDeviceAttributeReportHandler)(NSArray * _Nonnull); @@ -475,19 +478,42 @@ - (NSString *)description - (NSDictionary *)_internalProperties { NSMutableDictionary * properties = [NSMutableDictionary dictionary]; - std::lock_guard lock(_descriptionLock); + { + std::lock_guard lock(_descriptionLock); + + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyVendorID, _vid, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyProductID, _pid, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyNetworkFeatures, _allNetworkFeatures, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyMostRecentReportTime, _mostRecentReportTimeForDescription, properties); + } + + { + std::lock_guard lock(_lock); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceInternalState, [NSNumber numberWithUnsignedInteger:_internalDeviceState], properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionAttemptWait, [NSNumber numberWithUnsignedInt:_lastSubscriptionAttemptWait], properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionFailureTime, _lastSubscriptionFailureTime, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyVendorID, _vid, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyProductID, _pid, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyNetworkFeatures, _allNetworkFeatures, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceState, [NSNumber numberWithUnsignedInteger:_internalDeviceStateForDescription], properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionAttemptWait, [NSNumber numberWithUnsignedInt:_lastSubscriptionAttemptWaitForDescription], properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyMostRecentReportTime, _mostRecentReportTimeForDescription, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionFailureTime, _lastSubscriptionFailureTimeForDescription, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceState, @(_state), properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceCachePrimed, @(_deviceCachePrimed), properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyEstimatedStartTime, _estimatedStartTime, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyEstimatedSubscriptionLatency, _estimatedSubscriptionLatency, properties); + } return properties; } +- (nullable NSNumber *)vendorID +{ + std::lock_guard lock(_descriptionLock); + return [_vid copy]; +} + +- (nullable NSNumber *)productID +{ + std::lock_guard lock(_descriptionLock); + return [_pid copy]; +} + - (void)_notifyDelegateOfPrivateInternalPropertiesChanges { os_unfair_lock_assert_owner(&self->_lock); @@ -875,6 +901,14 @@ - (void)_triggerResubscribeWithReason:(NSString *)reason nodeLikelyReachable:(BO subscriptionCallback->ResetResubscriptionBackoff(); } readClientToResubscribe->TriggerResubscribeIfScheduled(reason.UTF8String); + } else if (_internalDeviceState == MTRInternalDeviceStateSubscribing && nodeLikelyReachable) { + // If we have reason to suspect that the node is now reachable and we haven’t established a + // CASE session yet, let’s consider it to be stalled and invalidate the pairing session. + [self._concreteController asyncGetCommissionerOnMatterQueue:^(Controller::DeviceCommissioner * commissioner) { + auto caseSessionMgr = commissioner->CASESessionMgr(); + VerifyOrDie(caseSessionMgr != nullptr); + caseSessionMgr->ReleaseSession(commissioner->GetPeerScopedId(self->_nodeID.unsignedLongLongValue)); + } errorHandler:nil /* not much we can do */]; } } @@ -956,6 +990,7 @@ - (void)_callDelegateDeviceCachePrimed [delegate deviceCachePrimed:self]; } }]; + [self _notifyDelegateOfPrivateInternalPropertiesChanges]; } // assume lock is held @@ -986,6 +1021,7 @@ - (void)_changeState:(MTRDeviceState)state [self _callDelegatesWithBlock:^(id delegate) { [delegate device:self stateChanged:state]; }]; + [self _notifyDelegateOfPrivateInternalPropertiesChanges]; } else { MTR_LOG( "%@ Not reporting reachability state change, since no change in state %lu => %lu", self, static_cast(lastState), static_cast(state)); @@ -1212,7 +1248,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds: workBlock(); }]; - [self->_deviceController.concurrentSubscriptionPool enqueueWorkItem:workItem description:description]; + [self._concreteController.concurrentSubscriptionPool enqueueWorkItem:workItem description:description]; MTR_LOG("%@ - enqueued in the subscription pool", self); }; @@ -1426,6 +1462,7 @@ - (void)_handleUnsolicitedMessageFromPublisher [delegate deviceBecameActive:self]; } }]; + [self _notifyDelegateOfPrivateInternalPropertiesChanges]; // in case this is called during exponential back off of subscription // reestablishment, this starts the attempt right away @@ -1513,7 +1550,7 @@ - (void)_persistClusterData // storage implementation, which will try to read them later. Make sure // we snapshot the state here instead of handing out live copies. NSDictionary * clusterData = [self _clusterDataToPersistSnapshot]; - [_deviceController.controllerDataStore storeClusterData:clusterData forNodeID:_nodeID]; + [self._concreteController.controllerDataStore storeClusterData:clusterData forNodeID:_nodeID]; for (MTRClusterPath * clusterPath in _clusterDataToPersist) { [_persistedClusterData setObject:_clusterDataToPersist[clusterPath] forKey:clusterPath]; [_persistedClusters addObject:clusterPath]; @@ -1887,8 +1924,13 @@ - (void)_handleAttributeReport:(NSArray *> *)attrib } // BEGIN DRAGON: This is used by the XPC Server to inject reports into local cache and broadcast them -- (void)_injectAttributeReport:(NSArray *> *)attributeReport fromSubscription:(BOOL)isFromSubscription +- (void)_injectAttributeReport:(NSArray *)attributeReport fromSubscription:(BOOL)isFromSubscription { + if (!MTRAttributeReportIsWellFormed(attributeReport)) { + MTR_LOG_ERROR("%@ injected attribute report is not well-formed: %@", self, attributeReport); + return; + } + [_deviceController asyncDispatchToMatterQueue:^{ MTR_LOG("%@ injected attribute report (%p) %@", self, attributeReport, attributeReport); [self _handleReportBegin]; @@ -1899,8 +1941,13 @@ - (void)_injectAttributeReport:(NSArray *> *)attrib } errorHandler:nil]; } -- (void)_injectEventReport:(NSArray *> *)eventReport +- (void)_injectEventReport:(NSArray *)eventReport { + if (!MTREventReportIsWellFormed(eventReport)) { + MTR_LOG_ERROR("%@ injected event report is not well-formed: %@", self, eventReport); + return; + } + // [_deviceController asyncDispatchToMatterQueue:^{ // TODO: This wasn't used previously, not sure why, so keeping it here for thought, but preserving existing behavior dispatch_async(self.queue, ^{ [self _handleEventReport:eventReport]; @@ -2096,7 +2143,7 @@ - (void)_reconcilePersistedClustersWithStorage NSMutableSet * clusterPathsToRemove = [NSMutableSet set]; for (MTRClusterPath * clusterPath in _persistedClusters) { - MTRDeviceClusterData * data = [_deviceController.controllerDataStore getStoredClusterDataForNodeID:_nodeID endpointID:clusterPath.endpoint clusterID:clusterPath.cluster]; + MTRDeviceClusterData * data = [self._concreteController.controllerDataStore getStoredClusterDataForNodeID:_nodeID endpointID:clusterPath.endpoint clusterID:clusterPath.cluster]; if (!data) { [clusterPathsToRemove addObject:clusterPath]; } @@ -2131,13 +2178,13 @@ - (nullable MTRDeviceClusterData *)_clusterDataForPath:(MTRClusterPath *)cluster return nil; } - NSAssert(_deviceController.controllerDataStore != nil, + NSAssert(self._concreteController.controllerDataStore != nil, @"How can _persistedClusters have an entry if we have no persistence?"); NSAssert(_persistedClusterData != nil, @"How can _persistedClusterData not exist if we have persisted clusters?"); // Page in the stored value for the data. - MTRDeviceClusterData * data = [_deviceController.controllerDataStore getStoredClusterDataForNodeID:_nodeID endpointID:clusterPath.endpoint clusterID:clusterPath.cluster]; + MTRDeviceClusterData * data = [self._concreteController.controllerDataStore getStoredClusterDataForNodeID:_nodeID endpointID:clusterPath.endpoint clusterID:clusterPath.cluster]; MTR_LOG("%@ cluster path %@ cache miss - load from storage success %@", self, clusterPath, MTR_YES_NO(data)); if (data != nil) { [_persistedClusterData setObject:data forKey:clusterPath]; @@ -2401,7 +2448,9 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason mtr_strongify(self); VerifyOrReturn(self); - [self _markDeviceAsUnreachableIfNeverSubscribed]; + if (!HaveSubscriptionEstablishedRightNow(self->_internalDeviceState)) { + [self _markDeviceAsUnreachableIfNeverSubscribed]; + } }); } @@ -2410,7 +2459,7 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason MATTER_LOG_METRIC_BEGIN(kMetricMTRDeviceInitialSubscriptionSetup); // Call directlyGetSessionForNode because the subscription setup already goes through the subscription pool queue - [[self _concreteController] + [self._concreteController directlyGetSessionForNode:_nodeID.unsignedLongLongValue completion:^(chip::Messaging::ExchangeManager * _Nullable exchangeManager, const chip::Optional & session, NSError * _Nullable error, @@ -3383,7 +3432,7 @@ - (void)_removeClusters:(NSSet *)clusterPathsToRemove [_persistedClusterData removeObjectForKey:path]; [_clusterDataToPersist removeObjectForKey:path]; if (doRemoveFromDataStore) { - [self.deviceController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:path.endpoint clusterID:path.cluster]; + [self._concreteController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:path.endpoint clusterID:path.cluster]; } } } @@ -3397,7 +3446,7 @@ - (void)_removeAttributes:(NSSet *)attributes fromCluster:(MTRCluste } // Just clear out the NSCache entry for this cluster, so we'll load it from storage as needed. [_persistedClusterData removeObjectForKey:clusterPath]; - [self.deviceController.controllerDataStore removeAttributes:attributes fromCluster:clusterPath forNodeID:self.nodeID]; + [self._concreteController.controllerDataStore removeAttributes:attributes fromCluster:clusterPath forNodeID:self.nodeID]; } - (void)_pruneEndpointsIn:(MTRDeviceDataValueDictionary)previousPartsListValue @@ -3418,7 +3467,7 @@ - (void)_pruneEndpointsIn:(MTRDeviceDataValueDictionary)previousPartsListValue } } [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:NO]; - [self.deviceController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:endpoint]; + [self._concreteController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:endpoint]; [_deviceController asyncDispatchToMatterQueue:^{ std::lock_guard lock(self->_lock); @@ -3578,6 +3627,8 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray_lock); - auto datastore = _deviceController.controllerDataStore; + auto datastore = self._concreteController.controllerDataStore; if (datastore == nil) { // No way to store. return; @@ -4161,7 +4212,6 @@ - (void)controllerResumed [self _ensureSubscriptionForExistingDelegates:@"Controller resumed"]; } -// nullable because technically _deviceController is nullable. - (nullable MTRDeviceController_Concrete *)_concreteController { // We know our _deviceController is actually an MTRDeviceController_Concrete, since that's what diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index 4414b3c613..ccd9dbebc8 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -22,7 +22,6 @@ #import "MTRAsyncWorkQueue.h" #import "MTRDefines_Internal.h" -#import "MTRDeviceDataValueDictionary.h" #import "MTRDeviceStorageBehaviorConfiguration_Internal.h" NS_ASSUME_NONNULL_BEGIN @@ -169,6 +168,16 @@ MTR_DIRECT_MEMBERS - (BOOL)_attributeDataValue:(MTRDeviceDataValueDictionary)one isEqualToDataValue:(MTRDeviceDataValueDictionary)theOther; - (BOOL)_attributeDataValue:(MTRDeviceDataValueDictionary)observed satisfiesValueExpectation:(MTRDeviceDataValueDictionary)expected; +// Hook for subclasses to notify us that an attribute value has been reported. +// +// For the MTRDevice_Concrete case this will be an actual reported value from +// the device. For the MTRDevice_XPC case, this might be an expected, not +// actual, value that is getting reported to us, if something sets up an +// expected value for the relevant attribute. +- (void)_attributeValue:(MTRDeviceDataValueDictionary)value reportedForPath:(MTRAttributePath *)path; + +- (void)_attributeWaitCanceled:(MTRAttributeValueWaiter *)attributeValueWaiter; + @end #pragma mark - MTRDevice internal state monitoring @@ -176,13 +185,6 @@ MTR_DIRECT_MEMBERS - (void)devicePrivateInternalStateChanged:(MTRDevice *)device internalState:(NSDictionary *)state; @end -// Returns whether a data-value dictionary is well-formed (in the sense that all -// the types of the objects inside are as expected, so it's actually a valid -// representation of some TLV). Implemented in MTRBaseDevice.mm because that's -// where the pieces needed to implement it are, but declared here so our tests -// can see it. -MTR_EXTERN MTR_TESTABLE BOOL MTRDataValueDictionaryIsWellFormed(MTRDeviceDataValueDictionary value); - #pragma mark - Constants static NSString * const kDefaultSubscriptionPoolSizeOverrideKey = @"subscriptionPoolSizeOverride"; @@ -195,9 +197,13 @@ static NSString * const kTestStorageUserDefaultEnabledKey = @"enableTestStorage" static NSString * const kMTRDeviceInternalPropertyKeyVendorID = @"MTRDeviceInternalStateKeyVendorID"; static NSString * const kMTRDeviceInternalPropertyKeyProductID = @"MTRDeviceInternalStateKeyProductID"; static NSString * const kMTRDeviceInternalPropertyNetworkFeatures = @"MTRDeviceInternalPropertyNetworkFeatures"; -static NSString * const kMTRDeviceInternalPropertyDeviceState = @"MTRDeviceInternalPropertyDeviceState"; +static NSString * const kMTRDeviceInternalPropertyDeviceInternalState = @"MTRDeviceInternalPropertyDeviceInternalState"; static NSString * const kMTRDeviceInternalPropertyLastSubscriptionAttemptWait = @"kMTRDeviceInternalPropertyLastSubscriptionAttemptWait"; static NSString * const kMTRDeviceInternalPropertyMostRecentReportTime = @"MTRDeviceInternalPropertyMostRecentReportTime"; static NSString * const kMTRDeviceInternalPropertyLastSubscriptionFailureTime = @"MTRDeviceInternalPropertyLastSubscriptionFailureTime"; +static NSString * const kMTRDeviceInternalPropertyDeviceState = @"MTRDeviceInternalPropertyDeviceState"; +static NSString * const kMTRDeviceInternalPropertyDeviceCachePrimed = @"MTRDeviceInternalPropertyDeviceCachePrimed"; +static NSString * const kMTRDeviceInternalPropertyEstimatedStartTime = @"MTRDeviceInternalPropertyEstimatedStartTime"; +static NSString * const kMTRDeviceInternalPropertyEstimatedSubscriptionLatency = @"MTRDeviceInternalPropertyEstimatedSubscriptionLatency"; NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm index 7782509fb7..b5fea425fa 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -41,7 +41,7 @@ #import "MTRDeviceControllerStartupParams_Internal.h" #import "MTRDeviceController_Concrete.h" #import "MTRDeviceController_XPC.h" -#import "MTRDeviceDataValueDictionary.h" +#import "MTRDeviceDataValidation.h" #import "MTRDevice_Concrete.h" #import "MTRDevice_Internal.h" #import "MTRDevice_XPC_Internal.h" @@ -56,6 +56,7 @@ #import "MTRSetupPayload.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" +#import "MTRUtilities.h" #import "NSDataSpanConversion.h" #import "NSStringSpanConversion.h" @@ -113,22 +114,31 @@ - (NSString *)description } // TODO: Add these to the description - // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceState, _internalDeviceStateForDescription, properties); // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionAttemptWait, _lastSubscriptionAttemptWaitForDescription, properties); // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyMostRecentReportTime, _mostRecentReportTimeForDescription, properties); // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionFailureTime, _lastSubscriptionFailureTimeForDescription, properties); - return [NSString - stringWithFormat:@"<%@: %p, node: %016llX-%016llX (%llu), VID: %@, PID: %@, WiFi: %@, Thread: %@, controller: %@>", - NSStringFromClass(self.class), self, - _deviceController.compressedFabricID.unsignedLongLongValue, - _nodeID.unsignedLongLongValue, - _nodeID.unsignedLongLongValue, - [self._internalState objectForKey:kMTRDeviceInternalPropertyKeyVendorID], - [self._internalState objectForKey:kMTRDeviceInternalPropertyKeyProductID], - wifi, - thread, - _deviceController.uniqueIdentifier]; + return [NSString stringWithFormat:@"<%@: %p, node: %016llX-%016llX (%llu), VID: %@, PID: %@, WiFi: %@, Thread: %@, controller: %@ state: %lu>", + NSStringFromClass(self.class), self, + _deviceController.compressedFabricID.unsignedLongLongValue, + _nodeID.unsignedLongLongValue, + _nodeID.unsignedLongLongValue, + [self vendorID], + [self productID], + wifi, + thread, + _deviceController.uniqueIdentifier, + (unsigned long) self.state]; +} + +- (nullable NSNumber *)vendorID +{ + return [[self._internalState objectForKey:kMTRDeviceInternalPropertyKeyVendorID] copy]; +} + +- (nullable NSNumber *)productID +{ + return [[self._internalState objectForKey:kMTRDeviceInternalPropertyKeyProductID] copy]; } #pragma mark - Client Callbacks (MTRDeviceDelegate) @@ -136,23 +146,67 @@ - (NSString *)description // required methods for MTRDeviceDelegates - (oneway void)device:(NSNumber *)nodeID stateChanged:(MTRDeviceState)state { - MTR_LOG("%s", __PRETTY_FUNCTION__); - [self _lockAndCallDelegatesWithBlock:^(id delegate) { - [delegate device:self stateChanged:state]; - }]; + // Not needed, since internal will get this } -- (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *> *)attributeReport +- (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *)attributeReport { - MTR_LOG("%s", __PRETTY_FUNCTION__); + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); + if (!MTR_SAFE_CAST(nodeID, NSNumber)) { + MTR_LOG_ERROR("%@ invalid device:receivedAttributeReport: nodeID: %@", self, nodeID); + return; + } + + if (!MTRAttributeReportIsWellFormed(attributeReport)) { + MTR_LOG_ERROR("%@ invalid device:receivedAttributeReport: attributeReport: %@", self, attributeReport); + return; + } + [self _lockAndCallDelegatesWithBlock:^(id delegate) { [delegate device:self receivedAttributeReport:attributeReport]; }]; + + std::lock_guard lock(_lock); + for (NSDictionary * report in attributeReport) { + if (!MTR_SAFE_CAST(report, NSDictionary)) { + MTR_LOG_ERROR("%@ handed a response-value that is not a dictionary: %@", self, report); + continue; + } + + MTRAttributePath * path = MTR_SAFE_CAST(report[MTRAttributePathKey], MTRAttributePath); + if (!path) { + MTR_LOG_ERROR("%@ no valid path for attribute report %@", self, report); + continue; + } + + MTRDeviceDataValueDictionary value = report[MTRDataKey]; + if (!value) { + // This is normal; this could be an error report. + continue; + } + + if (!MTR_SAFE_CAST(value, NSDictionary)) { + MTR_LOG_ERROR("%@ invalid data-value reported: %@", self, report); + continue; + } + + [self _attributeValue:value reportedForPath:path]; + } } -- (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray *> *)eventReport +- (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray *)eventReport { - MTR_LOG("%s", __PRETTY_FUNCTION__); + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); + if (!MTR_SAFE_CAST(nodeID, NSNumber)) { + MTR_LOG_ERROR("%@ invalid device:receivedEventReport: nodeID: %@", self, nodeID); + return; + } + + if (!MTREventReportIsWellFormed(eventReport)) { + MTR_LOG_ERROR("%@ invalid device:receivedEventReport: eventReport: %@", self, eventReport); + return; + } + [self _lockAndCallDelegatesWithBlock:^(id delegate) { [delegate device:self receivedEventReport:eventReport]; }]; @@ -161,7 +215,12 @@ - (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray delegate) { if ([delegate respondsToSelector:@selector(deviceBecameActive:)]) { [delegate deviceBecameActive:self]; @@ -171,15 +230,17 @@ - (oneway void)deviceBecameActive:(NSNumber *)nodeID - (oneway void)deviceCachePrimed:(NSNumber *)nodeID { - [self _lockAndCallDelegatesWithBlock:^(id delegate) { - if ([delegate respondsToSelector:@selector(deviceCachePrimed:)]) { - [delegate deviceCachePrimed:self]; - } - }]; + // Not needed since this is a state update now } - (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID { + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); + if (!MTR_SAFE_CAST(nodeID, NSNumber)) { + MTR_LOG_ERROR("%@ invalid deviceConfigurationChanged: nodeID: %@", self, nodeID); + return; + } + [self _lockAndCallDelegatesWithBlock:^(id delegate) { if ([delegate respondsToSelector:@selector(deviceConfigurationChanged:)]) { [delegate deviceConfigurationChanged:self]; @@ -187,18 +248,94 @@ - (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID }]; } +static const auto * requiredInternalStateKeys = @[ kMTRDeviceInternalPropertyDeviceState, kMTRDeviceInternalPropertyLastSubscriptionAttemptWait ]; +static const auto * optionalInternalStateKeys = @[ kMTRDeviceInternalPropertyKeyVendorID, kMTRDeviceInternalPropertyKeyProductID, kMTRDeviceInternalPropertyNetworkFeatures, kMTRDeviceInternalPropertyMostRecentReportTime, kMTRDeviceInternalPropertyLastSubscriptionFailureTime ]; + +- (BOOL)_internalState:(NSDictionary *)dictionary hasValidValuesForKeys:(const NSArray *)keys valueRequired:(BOOL)required +{ + // All the keys are NSNumber-valued. + for (NSString * key in keys) { + id value = dictionary[key]; + if (!value) { + if (required) { + MTR_LOG_ERROR("%@ device:internalStateUpdated: handed state with no value for \"%@\": %@", self, key, value); + return NO; + } + + continue; + } + if (!MTR_SAFE_CAST(value, NSNumber)) { + MTR_LOG_ERROR("%@ device:internalStateUpdated: handed state with invalid value for \"%@\": %@", self, key, value); + return NO; + } + } + + return YES; +} + - (oneway void)device:(NSNumber *)nodeID internalStateUpdated:(NSDictionary *)dictionary { + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); + if (!MTR_SAFE_CAST(nodeID, NSNumber)) { + MTR_LOG_ERROR("%@ invalid device:internalStateUpdated: nodeID: %@", self, nodeID); + return; + } + + if (!MTR_SAFE_CAST(dictionary, NSDictionary)) { + MTR_LOG_ERROR("%@ invalid device:internalStateUpdated dictionary: %@", self, dictionary); + return; + } + + NSNumber * oldStateNumber = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceState], NSNumber); + NSNumber * newStateNumber = MTR_SAFE_CAST(dictionary[kMTRDeviceInternalPropertyDeviceState], NSNumber); + + VerifyOrReturn([self _internalState:dictionary hasValidValuesForKeys:requiredInternalStateKeys valueRequired:YES]); + VerifyOrReturn([self _internalState:dictionary hasValidValuesForKeys:optionalInternalStateKeys valueRequired:NO]); + [self _setInternalState:dictionary]; - MTR_LOG("%@ internal state updated", self); + + if (!MTREqualObjects(oldStateNumber, newStateNumber)) { + MTRDeviceState state = self.state; + [self _lockAndCallDelegatesWithBlock:^(id delegate) { + [delegate device:self stateChanged:state]; + }]; + } + + NSNumber * oldPrimedState = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceCachePrimed], NSNumber); + NSNumber * newPrimedState = MTR_SAFE_CAST(dictionary[kMTRDeviceInternalPropertyDeviceCachePrimed], NSNumber); + + if (!MTREqualObjects(oldPrimedState, newPrimedState)) { + [self _lockAndCallDelegatesWithBlock:^(id delegate) { + if ([delegate respondsToSelector:@selector(deviceCachePrimed:)]) { + [delegate deviceCachePrimed:self]; + } + }]; + } } -#pragma mark - Remote Commands +- (MTRDeviceState)state +{ + NSNumber * stateNumber = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceState], NSNumber); + return stateNumber ? static_cast(stateNumber.unsignedIntegerValue) : MTRDeviceStateUnknown; +} + +- (BOOL)deviceCachePrimed +{ + NSNumber * deviceCachePrimedNumber = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceCachePrimed], NSNumber); + return deviceCachePrimedNumber.boolValue; +} + +- (nullable NSDate *)estimatedStartTime +{ + return MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyEstimatedStartTime], NSDate); +} -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(state, MTRDeviceState, MTRDeviceStateUnknown, getStateWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(deviceCachePrimed, BOOL, NO, getDeviceCachePrimedWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedStartTime, NSDate * _Nullable, nil, getEstimatedStartTimeWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedSubscriptionLatency, NSNumber * _Nullable, nil, getEstimatedSubscriptionLatencyWithReply) +- (nullable NSNumber *)estimatedSubscriptionLatency +{ + return MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyEstimatedSubscriptionLatency], NSNumber); +} + +#pragma mark - Remote Commands typedef NSDictionary * _Nullable ReadAttributeResponseType; MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(readAttributeWithEndpointID @@ -263,7 +400,34 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID expectedValueInterval:expectedValueInterval timedInvokeTimeout:timeout serverSideProcessingTimeout:serverSideProcessingTimeout - completion:completion]; + completion:^(NSArray *> * _Nullable values, NSError * _Nullable error) { + if (values == nil && error == nil) { + MTR_LOG_ERROR("%@ got invoke response for (%@, %@, %@) without values or error", self, endpointID, clusterID, commandID); + completion(nil, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]); + return; + } + + if (error != nil && !MTR_SAFE_CAST(error, NSError)) { + MTR_LOG_ERROR("%@ got invoke response for (%@, %@, %@) that has invalid error object: %@", self, endpointID, clusterID, commandID, error); + completion(nil, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]); + return; + } + + if (values != nil && !MTRInvokeResponseIsWellFormed(values)) { + MTR_LOG_ERROR("%@ got invoke response for (%@, %@, %@) that has invalid data: %@", self, clusterID, commandID, values, values); + completion(nil, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]); + return; + } + + if (values != nil && error != nil) { + MTR_LOG_ERROR("%@ got invoke response for (%@, %@, %@) with both values and error: %@, %@", self, endpointID, clusterID, commandID, values, error); + // Just propagate through the error. + completion(nil, error); + return; + } + + completion(values, error); + }]; } @catch (NSException * exception) { MTR_LOG_ERROR("Exception sending XPC message: %@", exception); completion(nil, [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeGeneralError userInfo:nil]); diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h index f74fb32a08..3d70954bb9 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h @@ -17,6 +17,8 @@ #import +#import "MTRDeviceController_Concrete.h" + #include NS_ASSUME_NONNULL_BEGIN @@ -35,7 +37,7 @@ class MTROTAProviderDelegateBridge : public chip::app::Clusters::OTAProviderDele // ControllerShuttingDown must be called on the Matter work queue, since it // touches Matter objects. - void ControllerShuttingDown(MTRDeviceController * controller); + void ControllerShuttingDown(MTRDeviceController_Concrete * controller); void HandleQueryImage( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm index e191b15acc..8729ac2a0f 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm @@ -112,7 +112,7 @@ CHIP_ERROR Shutdown() return CHIP_NO_ERROR; } - void ControllerShuttingDown(MTRDeviceController * controller) + void ControllerShuttingDown(MTRDeviceController_Concrete * controller) { assertChipStackLockedByCurrentThread(); @@ -506,7 +506,7 @@ CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId) void MTROTAProviderDelegateBridge::Shutdown() { gOtaSender->Shutdown(); } -void MTROTAProviderDelegateBridge::ControllerShuttingDown(MTRDeviceController * controller) +void MTROTAProviderDelegateBridge::ControllerShuttingDown(MTRDeviceController_Concrete * controller) { gOtaSender->ControllerShuttingDown(controller); } diff --git a/src/darwin/Framework/CHIP/MTRSessionResumptionStorageBridge.mm b/src/darwin/Framework/CHIP/MTRSessionResumptionStorageBridge.mm index 65e8eac55e..e79e565e14 100644 --- a/src/darwin/Framework/CHIP/MTRSessionResumptionStorageBridge.mm +++ b/src/darwin/Framework/CHIP/MTRSessionResumptionStorageBridge.mm @@ -18,6 +18,7 @@ #import "MTRConversion.h" #import "MTRDeviceControllerFactory_Internal.h" +#import "MTRDeviceController_Concrete.h" #import "MTRDeviceController_Internal.h" #import "MTRLogging_Internal.h" #import "NSDataSpanConversion.h" @@ -58,7 +59,7 @@ auto * resumptionIDData = AsData(resumptionId); auto * controllerList = [mFactory getRunningControllers]; - for (MTRDeviceController * controller in controllerList) { + for (MTRDeviceController_Concrete * controller in controllerList) { FabricIndex fabricIndex = controller.fabricIndex; if (!IsValidFabricIndex(fabricIndex)) { // This controller is not sufficiently "running"; it does not have a diff --git a/src/darwin/Framework/CHIP/Matter.h b/src/darwin/Framework/CHIP/Matter.h index 9f57e4fb4e..85a87c4ba1 100644 --- a/src/darwin/Framework/CHIP/Matter.h +++ b/src/darwin/Framework/CHIP/Matter.h @@ -21,6 +21,7 @@ #import #import +#import #import #import #import diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm index d21242956b..f719e07f34 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm @@ -50,6 +50,15 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) return Protocols::InteractionModel::Status::UnsupportedAttribute; } +Protocols::InteractionModel::Status emberAfWriteAttribute(const ConcreteAttributePath & path, const EmberAfWriteDataInput & input) +{ + assertChipStackLockedByCurrentThread(); + + // All of our attributes are handled via AttributeAccessInterface, so this + // should be unreached. + return Protocols::InteractionModel::Status::UnsupportedAttribute; +} + namespace chip { namespace app { diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm index e98bdc0b9e..67d546b463 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,6 @@ #include #include -#include #include using namespace chip; @@ -43,11 +43,12 @@ namespace { -class DeviceTypeResolver : public Access::AccessControl::DeviceTypeResolver { +class DeviceTypeResolver : public chip::Access::DynamicProviderDeviceTypeResolver { public: - bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) override + DeviceTypeResolver() + : chip::Access::DynamicProviderDeviceTypeResolver( + [] { return chip::app::InteractionModelEngine::GetInstance()->GetDataModelProvider(); }) { - return app::IsDeviceTypeOnEndpoint(deviceType, endpoint); } }; diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h index cfa59db8a7..7879ff61af 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @protocol MTRXPCClientProtocol_MTRDevice - (oneway void)device:(NSNumber *)nodeID stateChanged:(MTRDeviceState)state; - (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *> *)attributeReport; @@ -30,16 +30,18 @@ MTR_NEWLY_AVAILABLE - (oneway void)device:(NSNumber *)nodeID internalStateUpdated:(NSDictionary *)dictionary; @end -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @protocol MTRXPCClientProtocol_MTRDeviceController // Not Supported via XPC //- (oneway void)controller:(NSUUID *)controller statusUpdate:(MTRCommissioningStatus)status; //- (oneway void)controller:(NSUUID *)controller commissioningSessionEstablishmentDone:(NSError * _Nullable)error; //- (oneway void)controller:(NSUUID *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID metrics:(MTRMetrics * _Nullable)metrics; //- (oneway void)controller:(NSUUID *)controller readCommissioningInfo:(MTRProductIdentity *)info; +@optional +- (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(NSDictionary *)configuration; @end -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @protocol MTRXPCClientProtocol @end diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h index 9ecec60ae5..6daec1bb9d 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h @@ -18,11 +18,15 @@ NS_ASSUME_NONNULL_BEGIN -MTR_EXTERN NSString * const MTRDeviceControllerRegistrationNodeIDsKey MTR_NEWLY_AVAILABLE; -MTR_EXTERN NSString * const MTRDeviceControllerRegistrationNodeIDKey MTR_NEWLY_AVAILABLE; -MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerContextKey MTR_NEWLY_AVAILABLE; - -MTR_NEWLY_AVAILABLE +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationNodeIDsKey MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationNodeIDKey MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerContextKey MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerNodeIDKey MTR_NEWLY_AVAILABLE; +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerIsRunningKey MTR_NEWLY_AVAILABLE; +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationDeviceInternalStateKey MTR_NEWLY_AVAILABLE; +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerCompressedFabricIDKey MTR_NEWLY_AVAILABLE; + +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @protocol MTRXPCServerProtocol_MTRDevice - (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID getStateWithReply:(void (^)(MTRDeviceState state))reply; @@ -50,14 +54,10 @@ MTR_NEWLY_AVAILABLE @end -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @protocol MTRXPCServerProtocol_MTRDeviceController @optional -- (oneway void)deviceController:(NSUUID *)controller getIsRunningWithReply:(void (^)(BOOL response))reply; -- (oneway void)deviceController:(NSUUID *)controller getUniqueIdentifierWithReply:(void (^)(NSUUID *))reply; -- (oneway void)deviceController:(NSUUID *)controller controllerNodeIDWithReply:(void (^)(NSNumber * nodeID))reply; - // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void (^)(BOOL success, NSError * _Nullable error))reply; // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserResult *)discoveredDevice payload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void (^)(BOOL success, NSError * _Nullable error))reply; // - (oneway void)deviceController:(NSUUID *)controller commissionNodeWithID:(NSNumber *)nodeID commissioningParams:(MTRCommissioningParameters *)commissioningParams withReply:(void (^)(BOOL success, NSError * _Nullable error))reply; @@ -73,14 +73,14 @@ MTR_NEWLY_AVAILABLE - (oneway void)deviceController:(NSUUID *)controller registerNodeID:(NSNumber *)nodeID; - (oneway void)deviceController:(NSUUID *)controller unregisterNodeID:(NSNumber *)nodeID; +- (oneway void)deviceController:(NSUUID *)controller updateControllerConfiguration:(NSDictionary *)controllerState; @end -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) @protocol MTRXPCServerProtocol @optional - (oneway void)deviceController:(NSUUID *)controller checkInWithContext:(NSDictionary *)context; -- (oneway void)deviceController:(NSUUID *)controller updateControllerConfiguration:(NSDictionary *)controllerState; @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt index 606732b12a..a2524dbf58 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt @@ -236,4 +236,4 @@ typedef NS_ENUM(uint32_t, MTRDeviceTypeIDType) { MTRDeviceTypeIDType{{asUpperCamelCase caption preserveAcronyms=true}}ID {{availability "" deviceType=(asUpperCamelCase caption preserveAcronyms=true)}} = {{asHex code 8}}, {{/if}} {{/zcl_device_types}} -} MTR_NEWLY_AVAILABLE; +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index c8beeca677..60fe08f618 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9682,8 +9682,12 @@ - Presets - MatterScheduleConfiguration -- release: "Future" - versions: "future" +- release: "6C44AB2F-2F6B-4B57-B523-5CD89584986F" + versions: + iOS: "18.2" + macOS: "15.2" + watchOS: "11.2" + tvOS: "18.2" introduced: enums: ColorControl: @@ -10077,3 +10081,12 @@ - ColorLoop - XY - ColorTemperature + +- release: "Future" + versions: "future" + provisional: + device types: + - BatteryStorage + - HeatPump + - SolarPower + - WaterHeater diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 43e0528c25..3f55a10f84 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -5565,7 +5565,7 @@ static BOOL AttributeIsSpecifiedInZoneManagementCluster(AttributeId aAttributeId case Attributes::Zones::Id: { return YES; } - case Attributes::TimeControl::Id: { + case Attributes::Triggers::Id: { return YES; } case Attributes::Sensitivity::Id: { @@ -5673,15 +5673,6 @@ static BOOL AttributeIsSpecifiedInCameraAVStreamManagementCluster(AttributeId aA case Attributes::NightVisionIllum::Id: { return YES; } - case Attributes::AWBEnabled::Id: { - return YES; - } - case Attributes::AutoShutterSpeedEnabled::Id: { - return YES; - } - case Attributes::AutoISOEnabled::Id: { - return YES; - } case Attributes::Viewport::Id: { return YES; } @@ -5733,9 +5724,6 @@ static BOOL AttributeIsSpecifiedInCameraAVStreamManagementCluster(AttributeId aA case Attributes::StatusLightBrightness::Id: { return YES; } - case Attributes::DepthSensorStatus::Id: { - return YES; - } case Attributes::GeneratedCommandList::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 16f882fe47..571793a7ed 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -16853,8 +16853,8 @@ static id _Nullable DecodeAttributeValueForZoneManagementCluster(AttributeId aAt } return value; } - case Attributes::TimeControl::Id: { - using TypeInfo = Attributes::TimeControl::TypeInfo; + case Attributes::Triggers::Id: { + using TypeInfo = Attributes::Triggers::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -16866,12 +16866,17 @@ static id _Nullable DecodeAttributeValueForZoneManagementCluster(AttributeId aAt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRZoneManagementClusterZoneTriggeringTimeControlStruct * newElement_0; - newElement_0 = [MTRZoneManagementClusterZoneTriggeringTimeControlStruct new]; + MTRZoneManagementClusterZoneTriggerControlStruct * newElement_0; + newElement_0 = [MTRZoneManagementClusterZoneTriggerControlStruct new]; newElement_0.initialDuration = [NSNumber numberWithUnsignedShort:entry_0.initialDuration]; newElement_0.augmentationDuration = [NSNumber numberWithUnsignedShort:entry_0.augmentationDuration]; newElement_0.maxDuration = [NSNumber numberWithUnsignedInt:entry_0.maxDuration]; newElement_0.blindDuration = [NSNumber numberWithUnsignedShort:entry_0.blindDuration]; + if (entry_0.sensitivity.HasValue()) { + newElement_0.sensitivity = [NSNumber numberWithUnsignedChar:entry_0.sensitivity.Value()]; + } else { + newElement_0.sensitivity = nil; + } [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -17478,39 +17483,6 @@ static id _Nullable DecodeAttributeValueForCameraAVStreamManagementCluster(Attri value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } - case Attributes::AWBEnabled::Id: { - using TypeInfo = Attributes::AWBEnabled::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::AutoShutterSpeedEnabled::Id: { - using TypeInfo = Attributes::AutoShutterSpeedEnabled::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::AutoISOEnabled::Id: { - using TypeInfo = Attributes::AutoISOEnabled::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::Viewport::Id: { using TypeInfo = Attributes::Viewport::TypeInfo; TypeInfo::DecodableType cppValue; @@ -17702,17 +17674,6 @@ static id _Nullable DecodeAttributeValueForCameraAVStreamManagementCluster(Attri value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } - case Attributes::DepthSensorStatus::Id: { - using TypeInfo = Attributes::DepthSensorStatus::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; - } default: { break; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 9c1755c541..92212cc373 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -14074,13 +14074,13 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeZonesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeTimeControlWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeTimeControlWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeTimeControlWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeTriggersWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeTriggersWithValue:(NSArray * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeTriggersWithValue:(NSArray * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeTriggersWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeTriggersWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeSensitivityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeSensitivityWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; @@ -14199,30 +14199,6 @@ MTR_PROVISIONALLY_AVAILABLE * This command SHALL return a Snapshot from the camera. */ - (void)captureSnapshotWithParams:(MTRCameraAVStreamManagementClusterCaptureSnapshotParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetViewport - * - * This command sets the viewport in all video streams. - */ -- (void)setViewportWithParams:(MTRCameraAVStreamManagementClusterSetViewportParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetImageRotation - * - * The data fields for this command SHALL be as follows: - */ -- (void)setImageRotationWithParams:(MTRCameraAVStreamManagementClusterSetImageRotationParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetImageFlipHorizontal - * - * The data fields for this command SHALL be as follows: - */ -- (void)setImageFlipHorizontalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetImageFlipVertical - * - * The data fields for this command SHALL be as follows: - */ -- (void)setImageFlipVerticalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeMaxConcurrentVideoEncodersWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeMaxConcurrentVideoEncodersWithParams:(MTRSubscribeParams *)params @@ -14392,31 +14368,9 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeNightVisionIllumWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeAWBEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAWBEnabledWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAWBEnabledWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeAWBEnabledWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeAWBEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - -- (void)readAttributeAutoShutterSpeedEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeAutoShutterSpeedEnabledWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeAutoShutterSpeedEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - -- (void)readAttributeAutoISOEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoISOEnabledWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoISOEnabledWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeAutoISOEnabledWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeAutoISOEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeViewportWithCompletion:(void (^)(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeViewportWithValue:(MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeViewportWithValue:(MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeViewportWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; @@ -14439,16 +14393,12 @@ MTR_PROVISIONALLY_AVAILABLE + (void)readAttributeSpeakerVolumeLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeSpeakerMaxLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeSpeakerMaxLevelWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeSpeakerMaxLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeSpeakerMinLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMinLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMinLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeSpeakerMinLevelWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; @@ -14471,16 +14421,12 @@ MTR_PROVISIONALLY_AVAILABLE + (void)readAttributeMicrophoneVolumeLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeMicrophoneMaxLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeMicrophoneMaxLevelWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeMicrophoneMaxLevelWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeMicrophoneMinLevelWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeMicrophoneMinLevelWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; @@ -14495,18 +14441,24 @@ MTR_PROVISIONALLY_AVAILABLE + (void)readAttributeMicrophoneAGCEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeImageRotationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageRotationWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageRotationWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeImageRotationWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeImageRotationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeImageFlipHorizontalWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipHorizontalWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipHorizontalWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeImageFlipHorizontalWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeImageFlipHorizontalWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeImageFlipVerticalWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipVerticalWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipVerticalWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeImageFlipVerticalWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; @@ -14544,14 +14496,6 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeStatusLightBrightnessWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeDepthSensorStatusWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeDepthSensorStatusWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeDepthSensorStatusWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeDepthSensorStatusWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeDepthSensorStatusWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -19196,123 +19140,85 @@ typedef NS_ENUM(uint8_t, MTRColorControlColorLoopAction) { } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_ENUM(uint8_t, MTRColorControlColorLoopDirection) { - MTRColorControlColorLoopDirectionDecrement MTR_NEWLY_AVAILABLE = 0x00, - MTRColorControlColorLoopDirectionDecrementHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorLoopDirectionDecrement") - = 0x00, - MTRColorControlColorLoopDirectionIncrement MTR_NEWLY_AVAILABLE = 0x01, - MTRColorControlColorLoopDirectionIncrementHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorLoopDirectionIncrement") - = 0x01, + MTRColorControlColorLoopDirectionDecrement MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00, + MTRColorControlColorLoopDirectionDecrementHue MTR_DEPRECATED("Please use MTRColorControlColorLoopDirectionDecrement", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x00, + MTRColorControlColorLoopDirectionIncrement MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x01, + MTRColorControlColorLoopDirectionIncrementHue MTR_DEPRECATED("Please use MTRColorControlColorLoopDirectionIncrement", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x01, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_ENUM(uint8_t, MTRColorControlColorMode) { MTRColorControlColorModeCurrentHueAndCurrentSaturation MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, MTRColorControlColorModeCurrentXAndCurrentY MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlColorModeColorTemperatureMireds MTR_NEWLY_AVAILABLE = 0x02, - MTRColorControlColorModeColorTemperature MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorModeColorTemperatureMireds") - = 0x02, + MTRColorControlColorModeColorTemperatureMireds MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x02, + MTRColorControlColorModeColorTemperature MTR_DEPRECATED("Please use MTRColorControlColorModeColorTemperatureMireds", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x02, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_ENUM(uint8_t, MTRColorControlDirection) { - MTRColorControlDirectionShortest MTR_NEWLY_AVAILABLE = 0x00, - MTRColorControlDirectionLongest MTR_NEWLY_AVAILABLE = 0x01, - MTRColorControlDirectionUp MTR_NEWLY_AVAILABLE = 0x02, - MTRColorControlDirectionDown MTR_NEWLY_AVAILABLE = 0x03, -} MTR_NEWLY_AVAILABLE; + MTRColorControlDirectionShortest MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00, + MTRColorControlDirectionLongest MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x01, + MTRColorControlDirectionUp MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x02, + MTRColorControlDirectionDown MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x03, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_ENUM(uint8_t, MTRColorControlHueDirection) { - MTRColorControlHueDirectionShortestDistance MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionShortest") - = 0x00, - MTRColorControlHueDirectionLongestDistance MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionLongest") - = 0x01, - MTRColorControlHueDirectionUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionUp") - = 0x02, - MTRColorControlHueDirectionDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionDown") - = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirection"); + MTRColorControlHueDirectionShortestDistance MTR_DEPRECATED("Please use MTRColorControlDirectionShortest", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x00, + MTRColorControlHueDirectionLongestDistance MTR_DEPRECATED("Please use MTRColorControlDirectionLongest", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x01, + MTRColorControlHueDirectionUp MTR_DEPRECATED("Please use MTRColorControlDirectionUp", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x02, + MTRColorControlHueDirectionDown MTR_DEPRECATED("Please use MTRColorControlDirectionDown", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x03, +} MTR_DEPRECATED("Please use MTRColorControlDirection", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); typedef NS_ENUM(uint8_t, MTRColorControlDriftCompensation) { - MTRColorControlDriftCompensationNone MTR_NEWLY_AVAILABLE = 0x00, - MTRColorControlDriftCompensationOtherOrUnknown MTR_NEWLY_AVAILABLE = 0x01, - MTRColorControlDriftCompensationTemperatureMonitoring MTR_NEWLY_AVAILABLE = 0x02, - MTRColorControlDriftCompensationOpticalLuminanceMonitoringAndFeedback MTR_NEWLY_AVAILABLE = 0x03, - MTRColorControlDriftCompensationOpticalColorMonitoringAndFeedback MTR_NEWLY_AVAILABLE = 0x04, -} MTR_NEWLY_AVAILABLE; + MTRColorControlDriftCompensationNone MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00, + MTRColorControlDriftCompensationOtherOrUnknown MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x01, + MTRColorControlDriftCompensationTemperatureMonitoring MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x02, + MTRColorControlDriftCompensationOpticalLuminanceMonitoringAndFeedback MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x03, + MTRColorControlDriftCompensationOpticalColorMonitoringAndFeedback MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x04, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_ENUM(uint8_t, MTRColorControlEnhancedColorMode) { - MTRColorControlEnhancedColorModeCurrentHueAndCurrentSaturation MTR_NEWLY_AVAILABLE = 0x00, - MTRColorControlEnhancedColorModeCurrentXAndCurrentY MTR_NEWLY_AVAILABLE = 0x01, - MTRColorControlEnhancedColorModeColorTemperatureMireds MTR_NEWLY_AVAILABLE = 0x02, - MTRColorControlEnhancedColorModeEnhancedCurrentHueAndCurrentSaturation MTR_NEWLY_AVAILABLE = 0x03, -} MTR_NEWLY_AVAILABLE; + MTRColorControlEnhancedColorModeCurrentHueAndCurrentSaturation MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00, + MTRColorControlEnhancedColorModeCurrentXAndCurrentY MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x01, + MTRColorControlEnhancedColorModeColorTemperatureMireds MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x02, + MTRColorControlEnhancedColorModeEnhancedCurrentHueAndCurrentSaturation MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x03, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_ENUM(uint8_t, MTRColorControlMoveMode) { - MTRColorControlMoveModeStop MTR_NEWLY_AVAILABLE = 0x00, - MTRColorControlMoveModeUp MTR_NEWLY_AVAILABLE = 0x01, - MTRColorControlMoveModeDown MTR_NEWLY_AVAILABLE = 0x03, -} MTR_NEWLY_AVAILABLE; + MTRColorControlMoveModeStop MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00, + MTRColorControlMoveModeUp MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x01, + MTRColorControlMoveModeDown MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x03, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_ENUM(uint8_t, MTRColorControlHueMoveMode) { - MTRColorControlHueMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeStop") - = 0x00, - MTRColorControlHueMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeUp") - = 0x01, - MTRColorControlHueMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeDown") - = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveMode"); + MTRColorControlHueMoveModeStop MTR_DEPRECATED("Please use MTRColorControlMoveModeStop", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x00, + MTRColorControlHueMoveModeUp MTR_DEPRECATED("Please use MTRColorControlMoveModeUp", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x01, + MTRColorControlHueMoveModeDown MTR_DEPRECATED("Please use MTRColorControlMoveModeDown", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x03, +} MTR_DEPRECATED("Please use MTRColorControlMoveMode", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); typedef NS_ENUM(uint8_t, MTRColorControlStepMode) { - MTRColorControlStepModeUp MTR_NEWLY_AVAILABLE = 0x01, - MTRColorControlStepModeDown MTR_NEWLY_AVAILABLE = 0x03, -} MTR_NEWLY_AVAILABLE; + MTRColorControlStepModeUp MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x01, + MTRColorControlStepModeDown MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x03, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_ENUM(uint8_t, MTRColorControlHueStepMode) { - MTRColorControlHueStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeUp") - = 0x01, - MTRColorControlHueStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeDown") - = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepMode"); + MTRColorControlHueStepModeUp MTR_DEPRECATED("Please use MTRColorControlStepModeUp", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x01, + MTRColorControlHueStepModeDown MTR_DEPRECATED("Please use MTRColorControlStepModeDown", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x03, +} MTR_DEPRECATED("Please use MTRColorControlStepMode", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); typedef NS_OPTIONS(uint16_t, MTRColorControlColorCapabilitiesBitmap) { - MTRColorControlColorCapabilitiesBitmapHueSaturation MTR_NEWLY_AVAILABLE = 0x1, - MTRColorControlColorCapabilitiesBitmapEnhancedHue MTR_NEWLY_AVAILABLE = 0x2, - MTRColorControlColorCapabilitiesBitmapColorLoop MTR_NEWLY_AVAILABLE = 0x4, - MTRColorControlColorCapabilitiesBitmapXY MTR_NEWLY_AVAILABLE = 0x8, - MTRColorControlColorCapabilitiesBitmapColorTemperature MTR_NEWLY_AVAILABLE = 0x10, -} MTR_NEWLY_AVAILABLE; + MTRColorControlColorCapabilitiesBitmapHueSaturation MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x1, + MTRColorControlColorCapabilitiesBitmapEnhancedHue MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x2, + MTRColorControlColorCapabilitiesBitmapColorLoop MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x4, + MTRColorControlColorCapabilitiesBitmapXY MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x8, + MTRColorControlColorCapabilitiesBitmapColorTemperature MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x10, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_OPTIONS(uint16_t, MTRColorControlColorCapabilities) { - MTRColorControlColorCapabilitiesHueSaturationSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapHueSaturation") - = 0x1, - MTRColorControlColorCapabilitiesEnhancedHueSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapEnhancedHue") - = 0x2, - MTRColorControlColorCapabilitiesColorLoopSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapColorLoop") - = 0x4, - MTRColorControlColorCapabilitiesXYAttributesSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapXY") - = 0x8, - MTRColorControlColorCapabilitiesColorTemperatureSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapColorTemperature") - = 0x10, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmap"); + MTRColorControlColorCapabilitiesHueSaturationSupported MTR_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapHueSaturation", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x1, + MTRColorControlColorCapabilitiesEnhancedHueSupported MTR_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapEnhancedHue", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x2, + MTRColorControlColorCapabilitiesColorLoopSupported MTR_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapColorLoop", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x4, + MTRColorControlColorCapabilitiesXYAttributesSupported MTR_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapXY", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x8, + MTRColorControlColorCapabilitiesColorTemperatureSupported MTR_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapColorTemperature", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x10, +} MTR_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmap", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { MTRColorControlFeatureHueAndSaturation MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x1, @@ -19323,31 +19229,22 @@ typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_OPTIONS(uint8_t, MTRColorControlOptionsBitmap) { - MTRColorControlOptionsBitmapExecuteIfOff MTR_NEWLY_AVAILABLE = 0x1, -} MTR_NEWLY_AVAILABLE; + MTRColorControlOptionsBitmapExecuteIfOff MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x1, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_OPTIONS(uint8_t, MTRColorControlUpdateFlagsBitmap) { - MTRColorControlUpdateFlagsBitmapUpdateAction MTR_NEWLY_AVAILABLE = 0x1, - MTRColorControlUpdateFlagsBitmapUpdateDirection MTR_NEWLY_AVAILABLE = 0x2, - MTRColorControlUpdateFlagsBitmapUpdateTime MTR_NEWLY_AVAILABLE = 0x4, - MTRColorControlUpdateFlagsBitmapUpdateStartHue MTR_NEWLY_AVAILABLE = 0x8, -} MTR_NEWLY_AVAILABLE; + MTRColorControlUpdateFlagsBitmapUpdateAction MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x1, + MTRColorControlUpdateFlagsBitmapUpdateDirection MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x2, + MTRColorControlUpdateFlagsBitmapUpdateTime MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x4, + MTRColorControlUpdateFlagsBitmapUpdateStartHue MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x8, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); typedef NS_OPTIONS(uint8_t, MTRColorControlColorLoopUpdateFlags) { - MTRColorControlColorLoopUpdateFlagsUpdateAction MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateAction") - = 0x1, - MTRColorControlColorLoopUpdateFlagsUpdateDirection MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateDirection") - = 0x2, - MTRColorControlColorLoopUpdateFlagsUpdateTime MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateTime") - = 0x4, - MTRColorControlColorLoopUpdateFlagsUpdateStartHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateStartHue") - = 0x8, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmap"); + MTRColorControlColorLoopUpdateFlagsUpdateAction MTR_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateAction", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x1, + MTRColorControlColorLoopUpdateFlagsUpdateDirection MTR_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateDirection", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x2, + MTRColorControlColorLoopUpdateFlagsUpdateTime MTR_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateTime", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x4, + MTRColorControlColorLoopUpdateFlagsUpdateStartHue MTR_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateStartHue", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)) = 0x8, +} MTR_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmap", ios(16.1, 18.2), macos(13.0, 15.2), watchos(9.1, 11.2), tvos(16.1, 18.2)); typedef NS_OPTIONS(uint8_t, MTRBallastConfigurationBallastStatusBitmap) { MTRBallastConfigurationBallastStatusBitmapBallastNonOperational MTR_PROVISIONALLY_AVAILABLE = 0x1, @@ -20197,6 +20094,7 @@ typedef NS_ENUM(uint8_t, MTRZoneManagementZoneUse) { typedef NS_OPTIONS(uint32_t, MTRZoneManagementFeature) { MTRZoneManagementFeatureTwoDimensionalCartesianZone MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRZoneManagementFeaturePerZoneSensitivity MTR_PROVISIONALLY_AVAILABLE = 0x2, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRCameraAVStreamManagementAudioCodec) { @@ -20235,12 +20133,12 @@ typedef NS_ENUM(uint8_t, MTRCameraAVStreamManagementVideoCodec) { } MTR_PROVISIONALLY_AVAILABLE; typedef NS_OPTIONS(uint32_t, MTRCameraAVStreamManagementFeature) { - MTRCameraAVStreamManagementFeaturePrivacy MTR_PROVISIONALLY_AVAILABLE = 0x1, - MTRCameraAVStreamManagementFeatureAudio MTR_PROVISIONALLY_AVAILABLE = 0x2, - MTRCameraAVStreamManagementFeatureSpeaker MTR_PROVISIONALLY_AVAILABLE = 0x4, - MTRCameraAVStreamManagementFeatureImageControl MTR_PROVISIONALLY_AVAILABLE = 0x8, - MTRCameraAVStreamManagementFeatureVideo MTR_PROVISIONALLY_AVAILABLE = 0x10, - MTRCameraAVStreamManagementFeatureSnapshot MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTRCameraAVStreamManagementFeatureAudio MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRCameraAVStreamManagementFeatureVideo MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRCameraAVStreamManagementFeatureSnapshot MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRCameraAVStreamManagementFeaturePrivacy MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRCameraAVStreamManagementFeatureSpeaker MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTRCameraAVStreamManagementFeatureImageControl MTR_PROVISIONALLY_AVAILABLE = 0x20, MTRCameraAVStreamManagementFeatureWatermark MTR_PROVISIONALLY_AVAILABLE = 0x40, MTRCameraAVStreamManagementFeatureOnScreenDisplay MTR_PROVISIONALLY_AVAILABLE = 0x80, MTRCameraAVStreamManagementFeatureLocalStorage MTR_PROVISIONALLY_AVAILABLE = 0x100, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 3c347c4472..07e00f7088 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -97778,9 +97778,9 @@ + (void)readAttributeZonesWithClusterStateCache:(MTRClusterStateCacheContainer * completion:completion]; } -- (void)readAttributeTimeControlWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeTriggersWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ZoneManagement::Attributes::TimeControl::TypeInfo; + using TypeInfo = ZoneManagement::Attributes::Triggers::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -97789,11 +97789,11 @@ - (void)readAttributeTimeControlWithCompletion:(void (^)(NSArray * _Nullable val completion:completion]; } -- (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeTriggersWithValue:(NSArray * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self writeAttributeTimeControlWithValue:(NSArray * _Nonnull) value params:nil completion:completion]; + [self writeAttributeTriggersWithValue:(NSArray * _Nonnull) value params:nil completion:completion]; } -- (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeTriggersWithValue:(NSArray * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -97808,7 +97808,7 @@ - (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value params:(MTR } ListFreer listFreer; - using TypeInfo = ZoneManagement::Attributes::TimeControl::TypeInfo; + using TypeInfo = ZoneManagement::Attributes::Triggers::TypeInfo; TypeInfo::Type cppValue; { using ListType_0 = std::remove_reference_t; @@ -97820,15 +97820,19 @@ - (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value params:(MTR } listFreer.add(listHolder_0); for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if ( ! [value[i_0] isKindOfClass: [MTRZoneManagementClusterZoneTriggeringTimeControlStruct class]] ) { + if ( ! [value[i_0] isKindOfClass: [MTRZoneManagementClusterZoneTriggerControlStruct class]] ) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_0 = (MTRZoneManagementClusterZoneTriggeringTimeControlStruct *)value[i_0]; + auto element_0 = (MTRZoneManagementClusterZoneTriggerControlStruct *)value[i_0]; listHolder_0->mList[i_0].initialDuration = element_0.initialDuration.unsignedShortValue; listHolder_0->mList[i_0].augmentationDuration = element_0.augmentationDuration.unsignedShortValue; listHolder_0->mList[i_0].maxDuration = element_0.maxDuration.unsignedIntValue; listHolder_0->mList[i_0].blindDuration = element_0.blindDuration.unsignedShortValue; + if (element_0.sensitivity != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].sensitivity.Emplace(); + definedValue_2 = element_0.sensitivity.unsignedCharValue; + } } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -97841,11 +97845,11 @@ - (void)writeAttributeTimeControlWithValue:(NSArray * _Nonnull)value params:(MTR std::move(*bridge).DispatchAction(self.device); } -- (void)subscribeAttributeTimeControlWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeTriggersWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ZoneManagement::Attributes::TimeControl::TypeInfo; + using TypeInfo = ZoneManagement::Attributes::Triggers::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -97855,9 +97859,9 @@ - (void)subscribeAttributeTimeControlWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeTimeControlWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeTriggersWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ZoneManagement::Attributes::TimeControl::TypeInfo; + using TypeInfo = ZoneManagement::Attributes::Triggers::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -98330,102 +98334,6 @@ - (void)captureSnapshotWithParams:(MTRCameraAVStreamManagementClusterCaptureSnap queue:self.callbackQueue completion:responseHandler]; } -- (void)setViewportWithParams:(MTRCameraAVStreamManagementClusterSetViewportParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetViewportParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetViewport::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)setImageRotationWithParams:(MTRCameraAVStreamManagementClusterSetImageRotationParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetImageRotationParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetImageRotation::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)setImageFlipHorizontalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)setImageFlipVerticalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetImageFlipVertical::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - (void)readAttributeMaxConcurrentVideoEncodersWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { @@ -99552,137 +99460,9 @@ + (void)readAttributeNightVisionIllumWithClusterStateCache:(MTRClusterStateCache completion:completion]; } -- (void)readAttributeAWBEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AWBEnabled::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)writeAttributeAWBEnabledWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeAWBEnabledWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeAWBEnabledWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::AWBEnabled::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - -- (void)subscribeAttributeAWBEnabledWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AWBEnabled::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeAWBEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AWBEnabled::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeAutoShutterSpeedEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeAutoShutterSpeedEnabledWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.boolValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - -- (void)subscribeAttributeAutoShutterSpeedEnabledWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeAutoShutterSpeedEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeAutoISOEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeViewportWithCompletion:(void (^)(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = CameraAvStreamManagement::Attributes::AutoISOEnabled::TypeInfo; + using TypeInfo = CameraAvStreamManagement::Attributes::Viewport::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99691,11 +99471,11 @@ - (void)readAttributeAutoISOEnabledWithCompletion:(void (^)(NSNumber * _Nullable completion:completion]; } -- (void)writeAttributeAutoISOEnabledWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeViewportWithValue:(MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self writeAttributeAutoISOEnabledWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + [self writeAttributeViewportWithValue:(MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull) value params:nil completion:completion]; } -- (void)writeAttributeAutoISOEnabledWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeViewportWithValue:(MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -99710,51 +99490,18 @@ - (void)writeAttributeAutoISOEnabledWithValue:(NSNumber * _Nonnull)value params: } ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::AutoISOEnabled::TypeInfo; + using TypeInfo = CameraAvStreamManagement::Attributes::Viewport::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.boolValue; + cppValue.x1 = value.x1.unsignedShortValue; + cppValue.y1 = value.y1.unsignedShortValue; + cppValue.x2 = value.x2.unsignedShortValue; + cppValue.y2 = value.y2.unsignedShortValue; chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); std::move(*bridge).DispatchAction(self.device); } -- (void)subscribeAttributeAutoISOEnabledWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AutoISOEnabled::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeAutoISOEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::AutoISOEnabled::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeViewportWithCompletion:(void (^)(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::Viewport::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - - (void)subscribeAttributeViewportWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error))reportHandler @@ -99919,34 +99666,6 @@ - (void)readAttributeSpeakerMaxLevelWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeSpeakerMaxLevelWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::SpeakerMaxLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - - (void)subscribeAttributeSpeakerMaxLevelWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -99983,34 +99702,6 @@ - (void)readAttributeSpeakerMinLevelWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)writeAttributeSpeakerMinLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeSpeakerMinLevelWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeSpeakerMinLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::SpeakerMinLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - - (void)subscribeAttributeSpeakerMinLevelWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -100175,34 +99866,6 @@ - (void)readAttributeMicrophoneMaxLevelWithCompletion:(void (^)(NSNumber * _Null completion:completion]; } -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeMicrophoneMaxLevelWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::MicrophoneMaxLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - - (void)subscribeAttributeMicrophoneMaxLevelWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -100239,34 +99902,6 @@ - (void)readAttributeMicrophoneMinLevelWithCompletion:(void (^)(NSNumber * _Null completion:completion]; } -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeMicrophoneMinLevelWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::MicrophoneMinLevel::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - - (void)subscribeAttributeMicrophoneMinLevelWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -100367,6 +100002,34 @@ - (void)readAttributeImageRotationWithCompletion:(void (^)(NSNumber * _Nullable completion:completion]; } +- (void)writeAttributeImageRotationWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeImageRotationWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeImageRotationWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = CameraAvStreamManagement::Attributes::ImageRotation::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedShortValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + - (void)subscribeAttributeImageRotationWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -100403,6 +100066,34 @@ - (void)readAttributeImageFlipHorizontalWithCompletion:(void (^)(NSNumber * _Nul completion:completion]; } +- (void)writeAttributeImageFlipHorizontalWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeImageFlipHorizontalWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeImageFlipHorizontalWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = CameraAvStreamManagement::Attributes::ImageFlipHorizontal::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.boolValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + - (void)subscribeAttributeImageFlipHorizontalWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -100439,6 +100130,34 @@ - (void)readAttributeImageFlipVerticalWithCompletion:(void (^)(NSNumber * _Nulla completion:completion]; } +- (void)writeAttributeImageFlipVerticalWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeImageFlipVerticalWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeImageFlipVerticalWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = CameraAvStreamManagement::Attributes::ImageFlipVertical::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.boolValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + - (void)subscribeAttributeImageFlipVerticalWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler @@ -100720,70 +100439,6 @@ + (void)readAttributeStatusLightBrightnessWithClusterStateCache:(MTRClusterState completion:completion]; } -- (void)readAttributeDepthSensorStatusWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::DepthSensorStatus::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)writeAttributeDepthSensorStatusWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeDepthSensorStatusWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeDepthSensorStatusWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - - ListFreer listFreer; - using TypeInfo = CameraAvStreamManagement::Attributes::DepthSensorStatus::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedCharValue); - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - -- (void)subscribeAttributeDepthSensorStatusWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = CameraAvStreamManagement::Attributes::DepthSensorStatus::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeDepthSensorStatusWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = CameraAvStreamManagement::Attributes::DepthSensorStatus::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = CameraAvStreamManagement::Attributes::GeneratedCommandList::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index c44b789060..7587e25a24 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -4626,7 +4626,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { // Cluster ZoneManagement attributes MTRAttributeIDTypeClusterZoneManagementAttributeSupportedZoneSourcesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterZoneManagementAttributeZonesID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, - MTRAttributeIDTypeClusterZoneManagementAttributeTimeControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterZoneManagementAttributeTriggersID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, MTRAttributeIDTypeClusterZoneManagementAttributeSensitivityID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, MTRAttributeIDTypeClusterZoneManagementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterZoneManagementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, @@ -4661,27 +4661,23 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeHardPrivacyModeOnID MTR_PROVISIONALLY_AVAILABLE = 0x00000017, MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeNightVisionID MTR_PROVISIONALLY_AVAILABLE = 0x00000018, MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeNightVisionIllumID MTR_PROVISIONALLY_AVAILABLE = 0x00000019, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAWBEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x0000001A, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoShutterSpeedEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x0000001B, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoISOEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x0000001C, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeViewportID MTR_PROVISIONALLY_AVAILABLE = 0x0000001D, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMutedID MTR_PROVISIONALLY_AVAILABLE = 0x0000001E, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerVolumeLevelID MTR_PROVISIONALLY_AVAILABLE = 0x0000001F, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMaxLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000020, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMinLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000021, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMutedID MTR_PROVISIONALLY_AVAILABLE = 0x00000022, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneVolumeLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000023, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMaxLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000024, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMinLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000025, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneAGCEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x00000026, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageRotationID MTR_PROVISIONALLY_AVAILABLE = 0x00000027, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipHorizontalID MTR_PROVISIONALLY_AVAILABLE = 0x00000028, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipVerticalID MTR_PROVISIONALLY_AVAILABLE = 0x00000029, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeLocalVideoRecordingEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x0000002A, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeLocalSnapshotRecordingEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x0000002B, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeStatusLightEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x0000002C, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeStatusLightBrightnessID MTR_PROVISIONALLY_AVAILABLE = 0x0000002D, - MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeDepthSensorStatusID MTR_PROVISIONALLY_AVAILABLE = 0x0000002E, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeViewportID MTR_PROVISIONALLY_AVAILABLE = 0x0000001A, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMutedID MTR_PROVISIONALLY_AVAILABLE = 0x0000001B, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerVolumeLevelID MTR_PROVISIONALLY_AVAILABLE = 0x0000001C, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMaxLevelID MTR_PROVISIONALLY_AVAILABLE = 0x0000001D, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMinLevelID MTR_PROVISIONALLY_AVAILABLE = 0x0000001E, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMutedID MTR_PROVISIONALLY_AVAILABLE = 0x0000001F, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneVolumeLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000020, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMaxLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000021, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMinLevelID MTR_PROVISIONALLY_AVAILABLE = 0x00000022, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneAGCEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x00000023, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageRotationID MTR_PROVISIONALLY_AVAILABLE = 0x00000024, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipHorizontalID MTR_PROVISIONALLY_AVAILABLE = 0x00000025, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipVerticalID MTR_PROVISIONALLY_AVAILABLE = 0x00000026, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeLocalVideoRecordingEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x00000027, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeLocalSnapshotRecordingEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x00000028, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeStatusLightEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x00000029, + MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeStatusLightBrightnessID MTR_PROVISIONALLY_AVAILABLE = 0x0000002A, MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, @@ -6925,10 +6921,6 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetStreamPrioritiesID MTR_PROVISIONALLY_AVAILABLE = 0x0000000A, MTRCommandIDTypeClusterCameraAVStreamManagementCommandCaptureSnapshotID MTR_PROVISIONALLY_AVAILABLE = 0x0000000B, MTRCommandIDTypeClusterCameraAVStreamManagementCommandCaptureSnapshotResponseID MTR_PROVISIONALLY_AVAILABLE = 0x0000000C, - MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetViewportID MTR_PROVISIONALLY_AVAILABLE = 0x0000000D, - MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetImageRotationID MTR_PROVISIONALLY_AVAILABLE = 0x0000000E, - MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetImageFlipHorizontalID MTR_PROVISIONALLY_AVAILABLE = 0x0000000F, - MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetImageFlipVerticalID MTR_PROVISIONALLY_AVAILABLE = 0x00000010, // Cluster WebRTCTransportProvider commands MTRCommandIDTypeClusterWebRTCTransportProviderCommandSolicitOfferID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -7562,74 +7554,74 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { #pragma mark - Device Type IDs typedef NS_ENUM(uint32_t, MTRDeviceTypeIDType) { - MTRDeviceTypeIDTypeDoorLockID MTR_NEWLY_AVAILABLE = 0x0000000A, - MTRDeviceTypeIDTypeDoorLockControllerID MTR_NEWLY_AVAILABLE = 0x0000000B, - MTRDeviceTypeIDTypeAggregatorID MTR_NEWLY_AVAILABLE = 0x0000000E, - MTRDeviceTypeIDTypeGenericSwitchID MTR_NEWLY_AVAILABLE = 0x0000000F, - MTRDeviceTypeIDTypePowerSourceID MTR_NEWLY_AVAILABLE = 0x00000011, - MTRDeviceTypeIDTypeOTARequestorID MTR_NEWLY_AVAILABLE = 0x00000012, - MTRDeviceTypeIDTypeBridgedNodeID MTR_NEWLY_AVAILABLE = 0x00000013, - MTRDeviceTypeIDTypeOTAProviderID MTR_NEWLY_AVAILABLE = 0x00000014, - MTRDeviceTypeIDTypeContactSensorID MTR_NEWLY_AVAILABLE = 0x00000015, - MTRDeviceTypeIDTypeRootNodeID MTR_NEWLY_AVAILABLE = 0x00000016, + MTRDeviceTypeIDTypeDoorLockID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000000A, + MTRDeviceTypeIDTypeDoorLockControllerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000000B, + MTRDeviceTypeIDTypeAggregatorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000000E, + MTRDeviceTypeIDTypeGenericSwitchID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000000F, + MTRDeviceTypeIDTypePowerSourceID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000011, + MTRDeviceTypeIDTypeOTARequestorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000012, + MTRDeviceTypeIDTypeBridgedNodeID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000013, + MTRDeviceTypeIDTypeOTAProviderID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000014, + MTRDeviceTypeIDTypeContactSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000015, + MTRDeviceTypeIDTypeRootNodeID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000016, MTRDeviceTypeIDTypeSolarPowerID MTR_PROVISIONALLY_AVAILABLE = 0x00000017, MTRDeviceTypeIDTypeBatteryStorageID MTR_PROVISIONALLY_AVAILABLE = 0x00000018, - MTRDeviceTypeIDTypeSecondaryNetworkInterfaceID MTR_NEWLY_AVAILABLE = 0x00000019, - MTRDeviceTypeIDTypeSpeakerID MTR_NEWLY_AVAILABLE = 0x00000022, - MTRDeviceTypeIDTypeCastingVideoPlayerID MTR_NEWLY_AVAILABLE = 0x00000023, - MTRDeviceTypeIDTypeContentAppID MTR_NEWLY_AVAILABLE = 0x00000024, - MTRDeviceTypeIDTypeModeSelectID MTR_NEWLY_AVAILABLE = 0x00000027, - MTRDeviceTypeIDTypeBasicVideoPlayerID MTR_NEWLY_AVAILABLE = 0x00000028, - MTRDeviceTypeIDTypeCastingVideoClientID MTR_NEWLY_AVAILABLE = 0x00000029, - MTRDeviceTypeIDTypeVideoRemoteControlID MTR_NEWLY_AVAILABLE = 0x0000002A, - MTRDeviceTypeIDTypeFanID MTR_NEWLY_AVAILABLE = 0x0000002B, - MTRDeviceTypeIDTypeAirQualitySensorID MTR_NEWLY_AVAILABLE = 0x0000002C, - MTRDeviceTypeIDTypeAirPurifierID MTR_NEWLY_AVAILABLE = 0x0000002D, - MTRDeviceTypeIDTypeWaterFreezeDetectorID MTR_NEWLY_AVAILABLE = 0x00000041, - MTRDeviceTypeIDTypeWaterValveID MTR_NEWLY_AVAILABLE = 0x00000042, - MTRDeviceTypeIDTypeWaterLeakDetectorID MTR_NEWLY_AVAILABLE = 0x00000043, - MTRDeviceTypeIDTypeRainSensorID MTR_NEWLY_AVAILABLE = 0x00000044, - MTRDeviceTypeIDTypeRefrigeratorID MTR_NEWLY_AVAILABLE = 0x00000070, - MTRDeviceTypeIDTypeTemperatureControlledCabinetID MTR_NEWLY_AVAILABLE = 0x00000071, - MTRDeviceTypeIDTypeRoomAirConditionerID MTR_NEWLY_AVAILABLE = 0x00000072, - MTRDeviceTypeIDTypeLaundryWasherID MTR_NEWLY_AVAILABLE = 0x00000073, - MTRDeviceTypeIDTypeRoboticVacuumCleanerID MTR_NEWLY_AVAILABLE = 0x00000074, - MTRDeviceTypeIDTypeDishwasherID MTR_NEWLY_AVAILABLE = 0x00000075, - MTRDeviceTypeIDTypeSmokeCOAlarmID MTR_NEWLY_AVAILABLE = 0x00000076, - MTRDeviceTypeIDTypeCookSurfaceID MTR_NEWLY_AVAILABLE = 0x00000077, - MTRDeviceTypeIDTypeCooktopID MTR_NEWLY_AVAILABLE = 0x00000078, - MTRDeviceTypeIDTypeMicrowaveOvenID MTR_NEWLY_AVAILABLE = 0x00000079, - MTRDeviceTypeIDTypeExtractorHoodID MTR_NEWLY_AVAILABLE = 0x0000007A, - MTRDeviceTypeIDTypeOvenID MTR_NEWLY_AVAILABLE = 0x0000007B, - MTRDeviceTypeIDTypeLaundryDryerID MTR_NEWLY_AVAILABLE = 0x0000007C, - MTRDeviceTypeIDTypeNetworkInfrastructureManagerID MTR_NEWLY_AVAILABLE = 0x00000090, - MTRDeviceTypeIDTypeThreadBorderRouterID MTR_NEWLY_AVAILABLE = 0x00000091, - MTRDeviceTypeIDTypeOnOffLightID MTR_NEWLY_AVAILABLE = 0x00000100, - MTRDeviceTypeIDTypeDimmableLightID MTR_NEWLY_AVAILABLE = 0x00000101, - MTRDeviceTypeIDTypeOnOffLightSwitchID MTR_NEWLY_AVAILABLE = 0x00000103, - MTRDeviceTypeIDTypeDimmerSwitchID MTR_NEWLY_AVAILABLE = 0x00000104, - MTRDeviceTypeIDTypeColorDimmerSwitchID MTR_NEWLY_AVAILABLE = 0x00000105, - MTRDeviceTypeIDTypeLightSensorID MTR_NEWLY_AVAILABLE = 0x00000106, - MTRDeviceTypeIDTypeOccupancySensorID MTR_NEWLY_AVAILABLE = 0x00000107, - MTRDeviceTypeIDTypeOnOffPlugInUnitID MTR_NEWLY_AVAILABLE = 0x0000010A, - MTRDeviceTypeIDTypeDimmablePlugInUnitID MTR_NEWLY_AVAILABLE = 0x0000010B, - MTRDeviceTypeIDTypeColorTemperatureLightID MTR_NEWLY_AVAILABLE = 0x0000010C, - MTRDeviceTypeIDTypeExtendedColorLightID MTR_NEWLY_AVAILABLE = 0x0000010D, - MTRDeviceTypeIDTypeWindowCoveringID MTR_NEWLY_AVAILABLE = 0x00000202, - MTRDeviceTypeIDTypeWindowCoveringControllerID MTR_NEWLY_AVAILABLE = 0x00000203, - MTRDeviceTypeIDTypeHeatingCoolingUnitID MTR_NEWLY_AVAILABLE = 0x00000300, - MTRDeviceTypeIDTypeThermostatID MTR_NEWLY_AVAILABLE = 0x00000301, - MTRDeviceTypeIDTypeTemperatureSensorID MTR_NEWLY_AVAILABLE = 0x00000302, - MTRDeviceTypeIDTypePumpID MTR_NEWLY_AVAILABLE = 0x00000303, - MTRDeviceTypeIDTypePumpControllerID MTR_NEWLY_AVAILABLE = 0x00000304, - MTRDeviceTypeIDTypePressureSensorID MTR_NEWLY_AVAILABLE = 0x00000305, - MTRDeviceTypeIDTypeFlowSensorID MTR_NEWLY_AVAILABLE = 0x00000306, - MTRDeviceTypeIDTypeHumiditySensorID MTR_NEWLY_AVAILABLE = 0x00000307, + MTRDeviceTypeIDTypeSecondaryNetworkInterfaceID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000019, + MTRDeviceTypeIDTypeSpeakerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000022, + MTRDeviceTypeIDTypeCastingVideoPlayerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000023, + MTRDeviceTypeIDTypeContentAppID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000024, + MTRDeviceTypeIDTypeModeSelectID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000027, + MTRDeviceTypeIDTypeBasicVideoPlayerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000028, + MTRDeviceTypeIDTypeCastingVideoClientID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000029, + MTRDeviceTypeIDTypeVideoRemoteControlID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000002A, + MTRDeviceTypeIDTypeFanID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000002B, + MTRDeviceTypeIDTypeAirQualitySensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000002C, + MTRDeviceTypeIDTypeAirPurifierID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000002D, + MTRDeviceTypeIDTypeWaterFreezeDetectorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000041, + MTRDeviceTypeIDTypeWaterValveID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000042, + MTRDeviceTypeIDTypeWaterLeakDetectorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000043, + MTRDeviceTypeIDTypeRainSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000044, + MTRDeviceTypeIDTypeRefrigeratorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000070, + MTRDeviceTypeIDTypeTemperatureControlledCabinetID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000071, + MTRDeviceTypeIDTypeRoomAirConditionerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000072, + MTRDeviceTypeIDTypeLaundryWasherID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000073, + MTRDeviceTypeIDTypeRoboticVacuumCleanerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000074, + MTRDeviceTypeIDTypeDishwasherID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000075, + MTRDeviceTypeIDTypeSmokeCOAlarmID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000076, + MTRDeviceTypeIDTypeCookSurfaceID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000077, + MTRDeviceTypeIDTypeCooktopID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000078, + MTRDeviceTypeIDTypeMicrowaveOvenID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000079, + MTRDeviceTypeIDTypeExtractorHoodID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000007A, + MTRDeviceTypeIDTypeOvenID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000007B, + MTRDeviceTypeIDTypeLaundryDryerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000007C, + MTRDeviceTypeIDTypeNetworkInfrastructureManagerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000090, + MTRDeviceTypeIDTypeThreadBorderRouterID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000091, + MTRDeviceTypeIDTypeOnOffLightID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000100, + MTRDeviceTypeIDTypeDimmableLightID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000101, + MTRDeviceTypeIDTypeOnOffLightSwitchID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000103, + MTRDeviceTypeIDTypeDimmerSwitchID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000104, + MTRDeviceTypeIDTypeColorDimmerSwitchID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000105, + MTRDeviceTypeIDTypeLightSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000106, + MTRDeviceTypeIDTypeOccupancySensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000107, + MTRDeviceTypeIDTypeOnOffPlugInUnitID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000010A, + MTRDeviceTypeIDTypeDimmablePlugInUnitID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000010B, + MTRDeviceTypeIDTypeColorTemperatureLightID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000010C, + MTRDeviceTypeIDTypeExtendedColorLightID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000010D, + MTRDeviceTypeIDTypeWindowCoveringID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000202, + MTRDeviceTypeIDTypeWindowCoveringControllerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000203, + MTRDeviceTypeIDTypeHeatingCoolingUnitID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000300, + MTRDeviceTypeIDTypeThermostatID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000301, + MTRDeviceTypeIDTypeTemperatureSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000302, + MTRDeviceTypeIDTypePumpID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000303, + MTRDeviceTypeIDTypePumpControllerID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000304, + MTRDeviceTypeIDTypePressureSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000305, + MTRDeviceTypeIDTypeFlowSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000306, + MTRDeviceTypeIDTypeHumiditySensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000307, MTRDeviceTypeIDTypeHeatPumpID MTR_PROVISIONALLY_AVAILABLE = 0x00000309, - MTRDeviceTypeIDTypeEVSEID MTR_NEWLY_AVAILABLE = 0x0000050C, - MTRDeviceTypeIDTypeDeviceEnergyManagementID MTR_NEWLY_AVAILABLE = 0x0000050D, + MTRDeviceTypeIDTypeEVSEID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000050C, + MTRDeviceTypeIDTypeDeviceEnergyManagementID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x0000050D, MTRDeviceTypeIDTypeWaterHeaterID MTR_PROVISIONALLY_AVAILABLE = 0x0000050F, - MTRDeviceTypeIDTypeElectricalSensorID MTR_NEWLY_AVAILABLE = 0x00000510, - MTRDeviceTypeIDTypeControlBridgeID MTR_NEWLY_AVAILABLE = 0x00000840, - MTRDeviceTypeIDTypeOnOffSensorID MTR_NEWLY_AVAILABLE = 0x00000850, -} MTR_NEWLY_AVAILABLE; + MTRDeviceTypeIDTypeElectricalSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000510, + MTRDeviceTypeIDTypeControlBridgeID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000840, + MTRDeviceTypeIDTypeOnOffSensorID MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)) = 0x00000850, +} MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index ef41bc6487..0791fc4952 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -7688,8 +7688,8 @@ result = @"Zones"; break; - case MTRAttributeIDTypeClusterZoneManagementAttributeTimeControlID: - result = @"TimeControl"; + case MTRAttributeIDTypeClusterZoneManagementAttributeTriggersID: + result = @"Triggers"; break; case MTRAttributeIDTypeClusterZoneManagementAttributeSensitivityID: @@ -7831,18 +7831,6 @@ result = @"NightVisionIllum"; break; - case MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAWBEnabledID: - result = @"AWBEnabled"; - break; - - case MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoShutterSpeedEnabledID: - result = @"AutoShutterSpeedEnabled"; - break; - - case MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoISOEnabledID: - result = @"AutoISOEnabled"; - break; - case MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeViewportID: result = @"Viewport"; break; @@ -7911,10 +7899,6 @@ result = @"StatusLightBrightness"; break; - case MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeDepthSensorStatusID: - result = @"DepthSensorStatus"; - break; - case MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeGeneratedCommandListID: result = @"GeneratedCommandList"; break; @@ -10832,22 +10816,6 @@ result = @"CaptureSnapshot"; break; - case MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetViewportID: - result = @"SetViewport"; - break; - - case MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetImageRotationID: - result = @"SetImageRotation"; - break; - - case MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetImageFlipHorizontalID: - result = @"SetImageFlipHorizontal"; - break; - - case MTRCommandIDTypeClusterCameraAVStreamManagementCommandSetImageFlipVerticalID: - result = @"SetImageFlipVertical"; - break; - default: result = [NSString stringWithFormat:@"", commandID]; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 111cab13f8..4c28d0ddd3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -6592,9 +6592,9 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributeZonesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeTimeControlWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeTimeControlWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeTimeControlWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeTriggersWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeTriggersWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeTriggersWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeSensitivityWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeSensitivityWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; @@ -6643,10 +6643,6 @@ MTR_PROVISIONALLY_AVAILABLE - (void)snapshotStreamDeallocateWithParams:(MTRCameraAVStreamManagementClusterSnapshotStreamDeallocateParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)setStreamPrioritiesWithParams:(MTRCameraAVStreamManagementClusterSetStreamPrioritiesParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)captureSnapshotWithParams:(MTRCameraAVStreamManagementClusterCaptureSnapshotParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)setViewportWithParams:(MTRCameraAVStreamManagementClusterSetViewportParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)setImageRotationWithParams:(MTRCameraAVStreamManagementClusterSetImageRotationParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)setImageFlipHorizontalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)setImageFlipVerticalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeMaxConcurrentVideoEncodersWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; @@ -6712,19 +6708,9 @@ MTR_PROVISIONALLY_AVAILABLE - (void)writeAttributeNightVisionIllumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeNightVisionIllumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeAWBEnabledWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAWBEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAWBEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - -- (NSDictionary * _Nullable)readAttributeAutoShutterSpeedEnabledWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - -- (NSDictionary * _Nullable)readAttributeAutoISOEnabledWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoISOEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeAutoISOEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeViewportWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeViewportWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeViewportWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeSpeakerMutedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeSpeakerMutedWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; @@ -6735,12 +6721,8 @@ MTR_PROVISIONALLY_AVAILABLE - (void)writeAttributeSpeakerVolumeLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeSpeakerMaxLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeSpeakerMinLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeSpeakerMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeMicrophoneMutedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeMicrophoneMutedWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; @@ -6751,22 +6733,24 @@ MTR_PROVISIONALLY_AVAILABLE - (void)writeAttributeMicrophoneVolumeLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeMicrophoneMaxLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeMicrophoneMinLevelWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeMicrophoneAGCEnabledWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeMicrophoneAGCEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeMicrophoneAGCEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeImageRotationWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageRotationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageRotationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeImageFlipHorizontalWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipHorizontalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipHorizontalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeImageFlipVerticalWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipVerticalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeImageFlipVerticalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeLocalVideoRecordingEnabledWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeLocalVideoRecordingEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; @@ -6784,10 +6768,6 @@ MTR_PROVISIONALLY_AVAILABLE - (void)writeAttributeStatusLightBrightnessWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeStatusLightBrightnessWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeDepthSensorStatusWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeDepthSensorStatusWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeDepthSensorStatusWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index b473aed702..500aa41148 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -19012,20 +19012,20 @@ - (void)removeZoneWithParams:(MTRZoneManagementClusterRemoveZoneParams *)params return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeZoneManagementID) attributeID:@(MTRAttributeIDTypeClusterZoneManagementAttributeZonesID) params:params]; } -- (NSDictionary * _Nullable)readAttributeTimeControlWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeTriggersWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeZoneManagementID) attributeID:@(MTRAttributeIDTypeClusterZoneManagementAttributeTimeControlID) params:params]; + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeZoneManagementID) attributeID:@(MTRAttributeIDTypeClusterZoneManagementAttributeTriggersID) params:params]; } -- (void)writeAttributeTimeControlWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +- (void)writeAttributeTriggersWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs { - [self writeAttributeTimeControlWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; + [self writeAttributeTriggersWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; } -- (void)writeAttributeTimeControlWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +- (void)writeAttributeTriggersWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber * timedWriteTimeout = params.timedWriteTimeout; - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeZoneManagementID) attributeID:@(MTRAttributeIDTypeClusterZoneManagementAttributeTimeControlID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeZoneManagementID) attributeID:@(MTRAttributeIDTypeClusterZoneManagementAttributeTriggersID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } - (NSDictionary * _Nullable)readAttributeSensitivityWithParams:(MTRReadParams * _Nullable)params @@ -19316,114 +19316,6 @@ - (void)captureSnapshotWithParams:(MTRCameraAVStreamManagementClusterCaptureSnap completion:responseHandler]; } -- (void)setViewportWithParams:(MTRCameraAVStreamManagementClusterSetViewportParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetViewportParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetViewport::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - -- (void)setImageRotationWithParams:(MTRCameraAVStreamManagementClusterSetImageRotationParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetImageRotationParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetImageRotation::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - -- (void)setImageFlipHorizontalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - -- (void)setImageFlipVerticalWithParams:(MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = CameraAvStreamManagement::Commands::SetImageFlipVertical::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - - (NSDictionary * _Nullable)readAttributeMaxConcurrentVideoEncodersWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMaxConcurrentVideoEncodersID) params:params]; @@ -19620,57 +19512,20 @@ - (void)writeAttributeNightVisionIllumWithValue:(NSDictionary *) [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeNightVisionIllumID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } -- (NSDictionary * _Nullable)readAttributeAWBEnabledWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAWBEnabledID) params:params]; -} - -- (void)writeAttributeAWBEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeAWBEnabledWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeAWBEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAWBEnabledID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - -- (NSDictionary * _Nullable)readAttributeAutoShutterSpeedEnabledWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoShutterSpeedEnabledID) params:params]; -} - -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeAutoShutterSpeedEnabledWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeAutoShutterSpeedEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoShutterSpeedEnabledID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - -- (NSDictionary * _Nullable)readAttributeAutoISOEnabledWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeViewportWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoISOEnabledID) params:params]; + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeViewportID) params:params]; } -- (void)writeAttributeAutoISOEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +- (void)writeAttributeViewportWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs { - [self writeAttributeAutoISOEnabledWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; + [self writeAttributeViewportWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; } -- (void)writeAttributeAutoISOEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +- (void)writeAttributeViewportWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber * timedWriteTimeout = params.timedWriteTimeout; - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeAutoISOEnabledID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - -- (NSDictionary * _Nullable)readAttributeViewportWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeViewportID) params:params]; + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeViewportID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } - (NSDictionary * _Nullable)readAttributeSpeakerMutedWithParams:(MTRReadParams * _Nullable)params @@ -19710,33 +19565,11 @@ - (void)writeAttributeSpeakerVolumeLevelWithValue:(NSDictionary return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMaxLevelID) params:params]; } -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeSpeakerMaxLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeSpeakerMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMaxLevelID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - - (NSDictionary * _Nullable)readAttributeSpeakerMinLevelWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMinLevelID) params:params]; } -- (void)writeAttributeSpeakerMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeSpeakerMinLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeSpeakerMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeSpeakerMinLevelID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - - (NSDictionary * _Nullable)readAttributeMicrophoneMutedWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMutedID) params:params]; @@ -19774,33 +19607,11 @@ - (void)writeAttributeMicrophoneVolumeLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeMicrophoneMaxLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeMicrophoneMaxLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMaxLevelID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - - (NSDictionary * _Nullable)readAttributeMicrophoneMinLevelWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMinLevelID) params:params]; } -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeMicrophoneMinLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeMicrophoneMinLevelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneMinLevelID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - - (NSDictionary * _Nullable)readAttributeMicrophoneAGCEnabledWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeMicrophoneAGCEnabledID) params:params]; @@ -19822,16 +19633,49 @@ - (void)writeAttributeMicrophoneAGCEnabledWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeImageRotationWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeImageRotationWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageRotationID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + - (NSDictionary * _Nullable)readAttributeImageFlipHorizontalWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipHorizontalID) params:params]; } +- (void)writeAttributeImageFlipHorizontalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeImageFlipHorizontalWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeImageFlipHorizontalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipHorizontalID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + - (NSDictionary * _Nullable)readAttributeImageFlipVerticalWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipVerticalID) params:params]; } +- (void)writeAttributeImageFlipVerticalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeImageFlipVerticalWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeImageFlipVerticalWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeImageFlipVerticalID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + - (NSDictionary * _Nullable)readAttributeLocalVideoRecordingEnabledWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeLocalVideoRecordingEnabledID) params:params]; @@ -19896,22 +19740,6 @@ - (void)writeAttributeStatusLightBrightnessWithValue:(NSDictionary * _Nullable)readAttributeDepthSensorStatusWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeDepthSensorStatusID) params:params]; -} - -- (void)writeAttributeDepthSensorStatusWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttributeDepthSensorStatusWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)writeAttributeDepthSensorStatusWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber * timedWriteTimeout = params.timedWriteTimeout; - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeDepthSensorStatusID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCameraAVStreamManagementID) attributeID:@(MTRAttributeIDTypeClusterCameraAVStreamManagementAttributeGeneratedCommandListID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 6a5580c95b..c6dbb8e975 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -11395,126 +11395,6 @@ MTR_PROVISIONALLY_AVAILABLE error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTRCameraAVStreamManagementClusterSetViewportParams : NSObject - -@property (nonatomic, copy) MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull viewport MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; - -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -@end - -MTR_PROVISIONALLY_AVAILABLE -@interface MTRCameraAVStreamManagementClusterSetImageRotationParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull angle MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; - -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -@end - -MTR_PROVISIONALLY_AVAILABLE -@interface MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull enabled MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; - -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -@end - -MTR_PROVISIONALLY_AVAILABLE -@interface MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull enabled MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; - -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTRWebRTCTransportProviderClusterSolicitOfferParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 2010627d89..b737f253cb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -33160,325 +33160,6 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::CameraAv @end -@implementation MTRCameraAVStreamManagementClusterSetViewportParams -- (instancetype)init -{ - if (self = [super init]) { - - _viewport = [MTRCameraAVStreamManagementClusterViewportStruct new]; - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRCameraAVStreamManagementClusterSetViewportParams alloc] init]; - - other.viewport = self.viewport; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: viewport:%@; >", NSStringFromClass([self class]), _viewport]; - return descriptionString; -} - -@end - -@implementation MTRCameraAVStreamManagementClusterSetViewportParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.viewport.x1 = self.viewport.x1.unsignedShortValue; - encodableStruct.viewport.y1 = self.viewport.y1.unsignedShortValue; - encodableStruct.viewport.x2 = self.viewport.x2.unsignedShortValue; - encodableStruct.viewport.y2 = self.viewport.y2.unsignedShortValue; - } - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } - return nil; - } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - } - return decodedObj; -} -@end - -@implementation MTRCameraAVStreamManagementClusterSetImageRotationParams -- (instancetype)init -{ - if (self = [super init]) { - - _angle = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRCameraAVStreamManagementClusterSetImageRotationParams alloc] init]; - - other.angle = self.angle; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: angle:%@; >", NSStringFromClass([self class]), _angle]; - return descriptionString; -} - -@end - -@implementation MTRCameraAVStreamManagementClusterSetImageRotationParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.angle = self.angle.unsignedShortValue; - } - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } - return nil; - } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - } - return decodedObj; -} -@end - -@implementation MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams -- (instancetype)init -{ - if (self = [super init]) { - - _enabled = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams alloc] init]; - - other.enabled = self.enabled; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: enabled:%@; >", NSStringFromClass([self class]), _enabled]; - return descriptionString; -} - -@end - -@implementation MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.enabled = self.enabled.boolValue; - } - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } - return nil; - } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - } - return decodedObj; -} -@end - -@implementation MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams -- (instancetype)init -{ - if (self = [super init]) { - - _enabled = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams alloc] init]; - - other.enabled = self.enabled; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: enabled:%@; >", NSStringFromClass([self class]), _enabled]; - return descriptionString; -} - -@end - -@implementation MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.enabled = self.enabled.boolValue; - } - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } - return nil; - } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - } - return decodedObj; -} -@end - @implementation MTRWebRTCTransportProviderClusterSolicitOfferParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index 70d8a461c6..89f78e7a24 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -2146,30 +2146,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface MTRCameraAVStreamManagementClusterSetViewportParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - -@interface MTRCameraAVStreamManagementClusterSetImageRotationParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - -@interface MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - -@interface MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - @interface MTRWebRTCTransportProviderClusterSolicitOfferParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm index fc9d8c7d93..cec5339001 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm @@ -87,7 +87,7 @@ { 0x00000307, MTRDeviceTypeClass::Simple, "Humidity Sensor" }, { 0x00000309, MTRDeviceTypeClass::Simple, "Heat Pump" }, { 0x0000050C, MTRDeviceTypeClass::Simple, "EVSE" }, - { 0x0000050D, MTRDeviceTypeClass::Simple, "Device Energy Management" }, + { 0x0000050D, MTRDeviceTypeClass::Utility, "Device Energy Management" }, { 0x0000050F, MTRDeviceTypeClass::Simple, "Water Heater" }, { 0x00000510, MTRDeviceTypeClass::Utility, "Electrical Sensor" }, { 0x00000840, MTRDeviceTypeClass::Simple, "Control Bridge" }, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 02d36a82d7..9f679a7a30 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -2139,11 +2139,12 @@ MTR_PROVISIONALLY_AVAILABLE @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRZoneManagementClusterZoneTriggeringTimeControlStruct : NSObject +@interface MTRZoneManagementClusterZoneTriggerControlStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull initialDuration MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull augmentationDuration MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull maxDuration MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull blindDuration MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable sensitivity MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index e38df78931..ddc2286120 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -8867,7 +8867,7 @@ - (NSString *)description @end -@implementation MTRZoneManagementClusterZoneTriggeringTimeControlStruct +@implementation MTRZoneManagementClusterZoneTriggerControlStruct - (instancetype)init { if (self = [super init]) { @@ -8879,25 +8879,28 @@ - (instancetype)init _maxDuration = @(0); _blindDuration = @(0); + + _sensitivity = nil; } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTRZoneManagementClusterZoneTriggeringTimeControlStruct alloc] init]; + auto other = [[MTRZoneManagementClusterZoneTriggerControlStruct alloc] init]; other.initialDuration = self.initialDuration; other.augmentationDuration = self.augmentationDuration; other.maxDuration = self.maxDuration; other.blindDuration = self.blindDuration; + other.sensitivity = self.sensitivity; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: initialDuration:%@; augmentationDuration:%@; maxDuration:%@; blindDuration:%@; >", NSStringFromClass([self class]), _initialDuration, _augmentationDuration, _maxDuration, _blindDuration]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: initialDuration:%@; augmentationDuration:%@; maxDuration:%@; blindDuration:%@; sensitivity:%@; >", NSStringFromClass([self class]), _initialDuration, _augmentationDuration, _maxDuration, _blindDuration, _sensitivity]; return descriptionString; } diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 3fa4ff4544..a0dd9651bd 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -27,6 +27,7 @@ #import "MTRCommandPayloadExtensions_Internal.h" #import "MTRDeviceClusterData.h" #import "MTRDeviceControllerLocalTestStorage.h" +#import "MTRDeviceDataValidation.h" #import "MTRDeviceStorageBehaviorConfiguration.h" #import "MTRDeviceTestDelegate.h" #import "MTRDevice_Internal.h" @@ -1505,7 +1506,14 @@ - (void)test017_TestMTRDeviceBasics [device unitTestInjectEventReport:@[ @{ MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(1) clusterID:@(1) eventID:@(1)], MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), - MTREventTimestampDateKey : [NSDate date] + MTREventTimestampDateKey : [NSDate date], + MTREventIsHistoricalKey : @(NO), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventNumberKey : @(1), // Doesn't matter, in practice + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], + }, } ]]; #endif }; @@ -1578,6 +1586,37 @@ - (void)test017_TestMTRDeviceBasics XCTAssertEqualObjects([NSSet setWithArray:variousThings], [[NSSet setWithArray:clusterRevisions] setByAddingObjectsFromSet:[NSSet setWithArray:basicInformationAllRootAttributes]]); + // Some quick tests for waitForAttributeValues. First, values that we know + // are already there: + XCTestExpectation * deviceTypesWaitExpectation = [self expectationWithDescription:@"deviceTypes is already the value we expect"]; + __auto_type * deviceTypesToWaitFor = [NSMutableDictionary dictionary]; + for (NSDictionary * deviceTypesValue in deviceTypes) { + deviceTypesToWaitFor[deviceTypesValue[MTRAttributePathKey]] = deviceTypesValue[MTRDataKey]; + } + __auto_type * waiter1 = [device waitForAttributeValues:deviceTypesToWaitFor timeout:200 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNil(error); + [deviceTypesWaitExpectation fulfill]; + }]; + XCTAssertNotNil(waiter1); + [self waitForExpectations:@[ deviceTypesWaitExpectation ] timeout:kTimeoutInSeconds]; + + // Now values that we know will never be there (the type is wrong). + __auto_type * bogusDeviceType = @{ + deviceTypes[0][MTRAttributePathKey] : @ { + MTRTypeKey : MTROctetStringValueType, + MTRValueKey : [@"abc" dataUsingEncoding:NSUTF8StringEncoding], + }, + }; + XCTestExpectation * bogusDeviceTypesWaitExpectation = [self expectationWithDescription:@"bogusDeviceTypes wait should time out"]; + __auto_type * waiter2 = [device waitForAttributeValues:bogusDeviceType timeout:0.5 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.domain, MTRErrorDomain); + XCTAssertEqual(error.code, MTRErrorCodeTimeout); + [bogusDeviceTypesWaitExpectation fulfill]; + }]; + XCTAssertNotNil(waiter2); + [self waitForExpectations:@[ bogusDeviceTypesWaitExpectation ] timeout:kTimeoutInSeconds]; + // Before resubscribe, first test write failure and expected value effects NSNumber * testEndpointID = @(1); NSNumber * testClusterID = @(8); @@ -1602,6 +1641,23 @@ - (void)test017_TestMTRDeviceBasics NSDictionary * writeValue = [NSDictionary dictionaryWithObjectsAndKeys:@"UnsignedInteger", @"type", [NSNumber numberWithUnsignedInteger:200], @"value", nil]; + + // Also test that waitForAttributeValues does not pick up the transition to + // the expected value. + XCTestExpectation * nonexistentAttributeValueWaitExpectation = [self expectationWithDescription:@"waiting for a value for an attribute that does not exist should time out"]; + __auto_type * waiter3 = [device waitForAttributeValues:@{ + [MTRAttributePath attributePathWithEndpointID:testEndpointID clusterID:testClusterID attributeID:testAttributeID] : writeValue, + } + timeout:0.5 + queue:queue + completion:^(NSError * _Nullable error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.domain, MTRErrorDomain); + XCTAssertEqual(error.code, MTRErrorCodeTimeout); + [nonexistentAttributeValueWaitExpectation fulfill]; + }]; + XCTAssertNotNil(waiter3); + [device writeAttributeWithEndpointID:testEndpointID clusterID:testClusterID attributeID:testAttributeID @@ -1611,10 +1667,20 @@ - (void)test017_TestMTRDeviceBasics // expected value interval is 20s but expect it get reverted immediately as the write fails because it's writing to a // nonexistent attribute - [self waitForExpectations:@[ expectedValueReportedExpectation, expectedValueRemovedExpectation ] timeout:5 enforceOrder:YES]; - - // Test if previous value is reported on a write - uint16_t testOnTimeValue = 10; + [self waitForExpectations:@[ expectedValueReportedExpectation, expectedValueRemovedExpectation, nonexistentAttributeValueWaitExpectation ] timeout:5 enforceOrder:YES]; + + // Get the current OnTime value, to make sure we are writing a different one. + __auto_type * currentOnTimeValueDictionary = [device readAttributeWithEndpointID:@(1) + clusterID:@(MTRClusterIDTypeOnOffID) + attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOnTimeID) + params:nil]; + XCTAssertNotNil(currentOnTimeValueDictionary); + XCTAssertEqualObjects(currentOnTimeValueDictionary[MTRTypeKey], MTRUnsignedIntegerValueType); + uint16_t currentOnTimeValue = [currentOnTimeValueDictionary[MTRValueKey] unsignedShortValue]; + + // Test if previous value is reported on a write. Make sure to write a + // value different from the current one. + uint16_t testOnTimeValue = currentOnTimeValue > 10 ? currentOnTimeValue - 1 : currentOnTimeValue + 1; XCTestExpectation * onTimeWriteSuccess = [self expectationWithDescription:@"OnTime write success"]; XCTestExpectation * onTimePreviousValue = [self expectationWithDescription:@"OnTime previous value"]; delegate.onAttributeDataReceived = ^(NSArray *> * data) { @@ -1635,7 +1701,63 @@ - (void)test017_TestMTRDeviceBasics } } }; - NSDictionary * writeOnTimeValue = @{ MTRTypeKey : MTRUnsignedIntegerValueType, MTRValueKey : @(testOnTimeValue) }; + __auto_type * writeOnTimeValue = @{ MTRTypeKey : MTRUnsignedIntegerValueType, MTRValueKey : @(testOnTimeValue) }; + + // Also set up a few attribute value waits to see what happens. + __auto_type * onTimeValueToWaitFor = @{ + [MTRAttributePath attributePathWithEndpointID:@(1) clusterID:@(MTRClusterIDTypeOnOffID) + attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOnTimeID)] : writeOnTimeValue, + }; + + XCTestExpectation * waitingForOnTimeValue1Expectation = [self expectationWithDescription:@"OnTime value is now the expected value"]; + __auto_type * waiter4 = [device waitForAttributeValues:onTimeValueToWaitFor timeout:200 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNil(error); + [waitingForOnTimeValue1Expectation fulfill]; + }]; + XCTAssertNotNil(waiter4); + + XCTestExpectation * waitingForOnTimeValue2Expectation = [self expectationWithDescription:@"OnTime value is now the expected value and first device type is the expected value"]; + __auto_type * onTimeAndDeviceTypeValuesToWaitFor = [NSMutableDictionary dictionaryWithDictionary:onTimeValueToWaitFor]; + onTimeAndDeviceTypeValuesToWaitFor[deviceTypes[0][MTRAttributePathKey]] = deviceTypes[0][MTRDataKey]; + + __auto_type * waiter5 = [device waitForAttributeValues:onTimeAndDeviceTypeValuesToWaitFor timeout:200 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNil(error); + [waitingForOnTimeValue2Expectation fulfill]; + }]; + XCTAssertNotNil(waiter5); + + XCTestExpectation * waitingForOnTimeValue3Expectation = [self expectationWithDescription:@"OnTime value is now the expected value and first device type is bogus, or we timed out"]; + __auto_type * onTimeAndBogusDeviceTypeValuesToWaitFor = [NSMutableDictionary dictionaryWithDictionary:onTimeValueToWaitFor]; + [onTimeAndBogusDeviceTypeValuesToWaitFor addEntriesFromDictionary:bogusDeviceType]; + __auto_type * waiter6 = [device waitForAttributeValues:onTimeAndBogusDeviceTypeValuesToWaitFor timeout:0.5 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.domain, MTRErrorDomain); + XCTAssertEqual(error.code, MTRErrorCodeTimeout); + [waitingForOnTimeValue3Expectation fulfill]; + }]; + XCTAssertNotNil(waiter6); + + XCTestExpectation * waitingForOnTimeValue4Expectation = [self expectationWithDescription:@"Waiter should have been canceled"]; + __auto_type * waiter7 = [device waitForAttributeValues:onTimeValueToWaitFor timeout:200 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.domain, MTRErrorDomain); + XCTAssertEqual(error.code, MTRErrorCodeCancelled); + [waitingForOnTimeValue4Expectation fulfill]; + }]; + XCTAssertNotNil(waiter7); + [waiter7 cancel]; + + XCTestExpectation * waitingForOnTimeValue5Expectation = [self expectationWithDescription:@"Waiter should have been canceled due to being destroyed"]; + @autoreleasepool { + // To force the waiter created here to die quickly. + [device waitForAttributeValues:onTimeValueToWaitFor timeout:200 queue:queue completion:^(NSError * _Nullable error) { + XCTAssertNotNil(error); + XCTAssertEqual(error.domain, MTRErrorDomain); + XCTAssertEqual(error.code, MTRErrorCodeCancelled); + [waitingForOnTimeValue5Expectation fulfill]; + }]; + } + [device writeAttributeWithEndpointID:@(1) clusterID:@(MTRClusterIDTypeOnOffID) attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOnTimeID) @@ -1643,7 +1765,16 @@ - (void)test017_TestMTRDeviceBasics expectedValueInterval:@(10000) timedWriteTimeout:nil]; - [self waitForExpectations:@[ onTimeWriteSuccess, onTimePreviousValue ] timeout:10]; + [self waitForExpectations:@[ + onTimeWriteSuccess, + onTimePreviousValue, + waitingForOnTimeValue1Expectation, + waitingForOnTimeValue2Expectation, + waitingForOnTimeValue3Expectation, + waitingForOnTimeValue4Expectation, + waitingForOnTimeValue5Expectation, + ] + timeout:10]; __auto_type getOnOffValue = ^{ return [device readAttributeWithEndpointID:@(1) @@ -4139,7 +4270,14 @@ - (void)test037_MTRDeviceMultipleDelegatesGetReports MTREventPathKey : [MTREventPath eventPathWithEndpointID:endpointID clusterID:clusterID eventID:eventID], MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), MTREventTimestampDateKey : [NSDate date], - // For unit test no real data is needed, but timestamp is required + MTREventIsHistoricalKey : @(NO), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventNumberKey : @(1), // Doesn't matter, in practice + // Empty payload. + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], + }, }; } @@ -5187,6 +5325,319 @@ - (void)test041_AttributeDataValueValidation } } +- (void)test042_AttributeReportWellFormedness +{ + __auto_type * testData = @[ + @{ + @"input" : @[], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(6) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRBooleanValueType, + MTRValueKey : @(YES), + }, + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(6) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRBooleanValueType, + MTRValueKey : @(YES), + }, + }, + @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(6) attributeID:@(1)], + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:0 userInfo:nil], + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(6) attributeID:@(0)], + }, + @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(6) attributeID:@(1)], + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:0 userInfo:nil], + }, + ], + // Missing both error and data + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(6) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRBooleanValueType, + MTRValueKey : @("abc"), + }, + }, + ], + // Data dictionary is broken. + @"valid" : @(NO), + }, + @{ + @"input" : @ {}, + // Input is not an array. + @"valid" : @(NO), + }, + ]; + + for (NSDictionary * test in testData) { + XCTAssertEqual(MTRAttributeReportIsWellFormed(test[@"input"]), [test[@"valid"] boolValue], + "input: %@", test[@"input"]); + } +} + +- (void)test043_EventReportWellFormedness +{ + __auto_type * testData = @[ + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:0 userInfo:nil], + MTREventIsHistoricalKey : @(NO), + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // No fields + }, + MTREventNumberKey : @(5), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), + MTREventTimestampDateKey : [NSDate now], + MTREventIsHistoricalKey : @(NO), + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // No fields + }, + MTREventNumberKey : @(5), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeSystemUpTime), + MTREventSystemUpTimeKey : @(5), + MTREventIsHistoricalKey : @(NO), + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // No fields + }, + MTREventNumberKey : @(5), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), + MTREventTimestampDateKey : @(5), + MTREventIsHistoricalKey : @(NO), + }, + ], + // Wrong date type + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // No fields + }, + MTREventNumberKey : @("abc"), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeSystemUpTime), + MTREventSystemUpTimeKey : @(5), + MTREventIsHistoricalKey : @(NO), + }, + ], + // Wrong type of EventNumber + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // No fields + }, + MTREventNumberKey : @(5), + MTREventPriorityKey : @("abc"), + MTREventTimeTypeKey : @(MTREventTimeTypeSystemUpTime), + MTREventSystemUpTimeKey : @(5), + MTREventIsHistoricalKey : @(NO), + }, + ], + // Wrong type of EventPriority + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(6) eventID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // No fields + }, + MTREventNumberKey : @(5), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @("abc"), + MTREventSystemUpTimeKey : @(5), + MTREventIsHistoricalKey : @(NO), + }, + ], + // Wrong type of EventTimeType + @"valid" : @(NO), + }, + @{ + @"input" : @[ @(5) ], + // Wrong type of data entirely. + @"valid" : @(NO), + }, + @{ + @"input" : @ {}, + // Not even an array. + @"valid" : @(NO), + }, + ]; + + for (NSDictionary * test in testData) { + XCTAssertEqual(MTREventReportIsWellFormed(test[@"input"]), [test[@"valid"] boolValue], + "input: %@", test[@"input"]); + } +} + +- (void)test044_InvokeResponseWellFormedness +{ + __auto_type * testData = @[ + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + }, + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + }, + ], + // Multiple responses + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:0 userInfo:nil], + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // Empty structure, valid + }, + }, + ], + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + @"commandPath" : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + @"data" : @ { + @"type" : @"Structure", + @"value" : @[], // Empty structure, valid + }, + }, + ], + // Same as the previous test, but not using the SDK string constants + @"valid" : @(YES), + }, + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], // Empty structure, valid + }, + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:0 userInfo:nil], + }, + ], + // Having both data and error not valid. + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(5), + }, + }, + ], + // Data is not a struct. + @"valid" : @(NO), + }, + @{ + @"input" : @[ + @{ + MTRCommandPathKey : [MTRCommandPath commandPathWithEndpointID:@(0) clusterID:@(6) commandID:@(0)], + MTRDataKey : @(6), + }, + ], + // Data is not a data-value at all.. + @"valid" : @(NO), + }, + ]; + + for (NSDictionary * test in testData) { + XCTAssertEqual(MTRInvokeResponseIsWellFormed(test[@"input"]), [test[@"valid"] boolValue], + "input: %@", test[@"input"]); + } +} + @end @interface MTRDeviceEncoderTests : XCTestCase diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 721cb09b99..1ead4692a2 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -19,9 +19,9 @@ #import #import +#import "MTRDefines_Internal.h" #import "MTRDeviceClusterData.h" #import "MTRDeviceControllerLocalTestStorage.h" -#import "MTRDeviceDataValueDictionary.h" #import "MTRDeviceStorageBehaviorConfiguration.h" #import "MTRDeviceTestDelegate.h" #import "MTRDevice_Internal.h" @@ -2706,8 +2706,8 @@ - (void)doTestSubscriptionPoolWithSize:(NSInteger)subscriptionPoolSize deviceOnb // Given the base device read is happening on the 5th device, at the completion // time of the first [pool size] subscriptions, the BaseDevice's request to - // read can't have completed, as it should be gated on its call to the - // MTRDeviceController's getSessionForNode: call. + // read can't have completed, as it should be gated on its call to + // MTRDeviceController_Concrete's getSessionForNode:. if (subscriptionDequeueCount <= (orderedDeviceIDs.count - subscriptionPoolSize)) { XCTAssertFalse(baseDeviceReadCompleted); } diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h index b00507d665..591110b34e 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h @@ -18,8 +18,8 @@ #import #import +#import "MTRDefines_Internal.h" #import "MTRDeviceClusterData.h" -#import "MTRDeviceDataValueDictionary.h" #import "MTRDevice_Internal.h" NS_ASSUME_NONNULL_BEGIN diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index a08a406778..fa1634da4b 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -134,7 +134,8 @@ 5109E9B72CB8B83D0006884B /* MTRDeviceTypeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5109E9B62CB8B83D0006884B /* MTRDeviceTypeTests.m */; }; 5109E9BA2CC1F23E0006884B /* MTRDeviceClusterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5109E9B82CC1F23E0006884B /* MTRDeviceClusterData.h */; }; 5109E9BB2CC1F23E0006884B /* MTRDeviceClusterData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5109E9B92CC1F23E0006884B /* MTRDeviceClusterData.mm */; }; - 5109E9BD2CC1F25C0006884B /* MTRDeviceDataValueDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 5109E9BC2CC1F25C0006884B /* MTRDeviceDataValueDictionary.h */; }; + 5109E9C02CCAD64F0006884B /* MTRDeviceDataValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5109E9BE2CCAD64F0006884B /* MTRDeviceDataValidation.h */; }; + 5109E9C12CCAD64F0006884B /* MTRDeviceDataValidation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5109E9BF2CCAD64F0006884B /* MTRDeviceDataValidation.mm */; }; 510A07492A685D3900A9241C /* Matter.apinotes in Headers */ = {isa = PBXBuildFile; fileRef = 510A07482A685D3900A9241C /* Matter.apinotes */; settings = {ATTRIBUTES = (Public, ); }; }; 510CECA8297F72970064E0B3 /* MTROperationalCertificateIssuerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 510CECA6297F72470064E0B3 /* MTROperationalCertificateIssuerTests.m */; }; 5117DD3829A931AE00FFA1AA /* MTROperationalBrowser.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5117DD3629A931AD00FFA1AA /* MTROperationalBrowser.mm */; }; @@ -160,8 +161,9 @@ 5143851E2A65885500EDC8E6 /* MTRSwiftPairingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5143851D2A65885500EDC8E6 /* MTRSwiftPairingTests.swift */; }; 514654492A72F9DF00904E61 /* MTRDemuxingStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514654482A72F9DF00904E61 /* MTRDemuxingStorage.mm */; }; 5146544B2A72F9F500904E61 /* MTRDemuxingStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5146544A2A72F9F500904E61 /* MTRDemuxingStorage.h */; }; - 514C79ED2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C79EC2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp */; }; - 514C79EE2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C79EC2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp */; }; + 514A98AF2CD98C5E000EF4FD /* MTRAttributeValueWaiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 514A98AC2CD98C5E000EF4FD /* MTRAttributeValueWaiter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 514A98B02CD98C5E000EF4FD /* MTRAttributeValueWaiter_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 514A98AE2CD98C5E000EF4FD /* MTRAttributeValueWaiter_Internal.h */; }; + 514A98B12CD98C5E000EF4FD /* MTRAttributeValueWaiter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514A98AD2CD98C5E000EF4FD /* MTRAttributeValueWaiter.mm */; }; 514C79F02B62ADDA00DD6D7B /* descriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C79EF2B62ADDA00DD6D7B /* descriptor.cpp */; }; 514C79F12B62ADDA00DD6D7B /* descriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C79EF2B62ADDA00DD6D7B /* descriptor.cpp */; }; 514C79F32B62ED5500DD6D7B /* attribute-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C79F22B62ED5500DD6D7B /* attribute-storage.cpp */; }; @@ -265,6 +267,26 @@ 754784672BFE93B00089C372 /* MTRDeviceStorageBehaviorConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 754784632BFE65B70089C372 /* MTRDeviceStorageBehaviorConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 754F3DF427FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 754F3DF327FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h */; }; 7560FD1C27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7560FD1B27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm */; }; + 7592BCF32CBEE98C00EB74A0 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BCF12CBEE98C00EB74A0 /* Instance.h */; }; + 7592BCF42CBEE98C00EB74A0 /* EmberMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BCEF2CBEE98C00EB74A0 /* EmberMetadata.h */; }; + 7592BCF52CBEE98C00EB74A0 /* CodegenDataModelProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BCEB2CBEE98C00EB74A0 /* CodegenDataModelProvider.h */; }; + 7592BCF62CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCED2CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp */; }; + 7592BCF72CBEE98C00EB74A0 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCF22CBEE98C00EB74A0 /* Instance.cpp */; }; + 7592BCF82CBEE98C00EB74A0 /* EmberMetadata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCF02CBEE98C00EB74A0 /* EmberMetadata.cpp */; }; + 7592BCF92CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCEC2CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp */; }; + 7592BCFA2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCEE2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp */; }; + 7592BCFB2CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCED2CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp */; }; + 7592BCFC2CBEE98C00EB74A0 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCF22CBEE98C00EB74A0 /* Instance.cpp */; }; + 7592BCFD2CBEE98C00EB74A0 /* EmberMetadata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCF02CBEE98C00EB74A0 /* EmberMetadata.cpp */; }; + 7592BCFE2CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCEC2CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp */; }; + 7592BCFF2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BCEE2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp */; }; + 7592BD002CBEE98C00EB74A0 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BCF12CBEE98C00EB74A0 /* Instance.h */; }; + 7592BD012CBEE98C00EB74A0 /* EmberMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BCEF2CBEE98C00EB74A0 /* EmberMetadata.h */; }; + 7592BD022CBEE98C00EB74A0 /* CodegenDataModelProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BCEB2CBEE98C00EB74A0 /* CodegenDataModelProvider.h */; }; + 7592BD0B2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BD0A2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp */; }; + 7592BD0C2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BD092CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h */; }; + 7592BD0D2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7592BD092CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h */; }; + 7592BD0E2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7592BD0A2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp */; }; 7596A83E28751220004DAE0E /* MTRBaseClusters_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A83D28751220004DAE0E /* MTRBaseClusters_Internal.h */; }; 7596A84428762729004DAE0E /* MTRDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A84228762729004DAE0E /* MTRDevice.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7596A84528762729004DAE0E /* MTRDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7596A84328762729004DAE0E /* MTRDevice.mm */; }; @@ -335,6 +357,8 @@ B2E0D7B7245B0B5C003C5B48 /* MTRQRCodeSetupPayloadParser.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2E0D7AE245B0B5C003C5B48 /* MTRQRCodeSetupPayloadParser.mm */; }; B2E0D7B8245B0B5C003C5B48 /* MTRSetupPayload.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0D7AF245B0B5C003C5B48 /* MTRSetupPayload.h */; settings = {ATTRIBUTES = (Public, ); }; }; B2E0D7B9245B0B5C003C5B48 /* MTRSetupPayload.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2E0D7B0245B0B5C003C5B48 /* MTRSetupPayload.mm */; }; + B409D0AE2CCFB89600A7ED5A /* DeviceDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B409D0AC2CCFB89600A7ED5A /* DeviceDelegate.h */; }; + B409D0AF2CCFB89600A7ED5A /* DeviceDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = B409D0AD2CCFB89600A7ED5A /* DeviceDelegate.mm */; }; B43B39EA2CB859A5006AA284 /* DumpMemoryGraphCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = B43B39E62CB859A5006AA284 /* DumpMemoryGraphCommand.mm */; }; B43B39EB2CB859A5006AA284 /* LeaksTool.mm in Sources */ = {isa = PBXBuildFile; fileRef = B43B39E82CB859A5006AA284 /* LeaksTool.mm */; }; B43B39EC2CB859A5006AA284 /* DumpMemoryGraphCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B43B39E52CB859A5006AA284 /* DumpMemoryGraphCommand.h */; }; @@ -589,7 +613,8 @@ 5109E9B62CB8B83D0006884B /* MTRDeviceTypeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRDeviceTypeTests.m; sourceTree = ""; }; 5109E9B82CC1F23E0006884B /* MTRDeviceClusterData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceClusterData.h; sourceTree = ""; }; 5109E9B92CC1F23E0006884B /* MTRDeviceClusterData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceClusterData.mm; sourceTree = ""; }; - 5109E9BC2CC1F25C0006884B /* MTRDeviceDataValueDictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceDataValueDictionary.h; sourceTree = ""; }; + 5109E9BE2CCAD64F0006884B /* MTRDeviceDataValidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceDataValidation.h; sourceTree = ""; }; + 5109E9BF2CCAD64F0006884B /* MTRDeviceDataValidation.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceDataValidation.mm; sourceTree = ""; }; 510A07482A685D3900A9241C /* Matter.apinotes */ = {isa = PBXFileReference; lastKnownFileType = text.apinotes; name = Matter.apinotes; path = CHIP/Matter.apinotes; sourceTree = ""; }; 510CECA6297F72470064E0B3 /* MTROperationalCertificateIssuerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTROperationalCertificateIssuerTests.m; sourceTree = ""; }; 5117DD3629A931AD00FFA1AA /* MTROperationalBrowser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTROperationalBrowser.mm; sourceTree = ""; }; @@ -617,7 +642,9 @@ 5143851D2A65885500EDC8E6 /* MTRSwiftPairingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTRSwiftPairingTests.swift; sourceTree = ""; }; 514654482A72F9DF00904E61 /* MTRDemuxingStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDemuxingStorage.mm; sourceTree = ""; }; 5146544A2A72F9F500904E61 /* MTRDemuxingStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDemuxingStorage.h; sourceTree = ""; }; - 514C79EC2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ember-compatibility-functions.cpp"; path = "util/ember-compatibility-functions.cpp"; sourceTree = ""; }; + 514A98AC2CD98C5E000EF4FD /* MTRAttributeValueWaiter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRAttributeValueWaiter.h; sourceTree = ""; }; + 514A98AD2CD98C5E000EF4FD /* MTRAttributeValueWaiter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRAttributeValueWaiter.mm; sourceTree = ""; }; + 514A98AE2CD98C5E000EF4FD /* MTRAttributeValueWaiter_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRAttributeValueWaiter_Internal.h; sourceTree = ""; }; 514C79EF2B62ADDA00DD6D7B /* descriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = descriptor.cpp; path = clusters/descriptor/descriptor.cpp; sourceTree = ""; }; 514C79F22B62ED5500DD6D7B /* attribute-storage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "attribute-storage.cpp"; path = "util/attribute-storage.cpp"; sourceTree = ""; }; 514C79F52B62F0B900DD6D7B /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = util.cpp; path = util/util.cpp; sourceTree = ""; }; @@ -725,6 +752,16 @@ 754784662BFE6B890089C372 /* MTRDeviceStorageBehaviorConfiguration_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceStorageBehaviorConfiguration_Internal.h; sourceTree = ""; }; 754F3DF327FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTREventTLVValueDecoder_Internal.h; sourceTree = ""; }; 7560FD1B27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTREventTLVValueDecoder.mm; sourceTree = ""; }; + 7592BCEB2CBEE98C00EB74A0 /* CodegenDataModelProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CodegenDataModelProvider.h; sourceTree = ""; }; + 7592BCEC2CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodegenDataModelProvider.cpp; sourceTree = ""; }; + 7592BCED2CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodegenDataModelProvider_Read.cpp; sourceTree = ""; }; + 7592BCEE2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CodegenDataModelProvider_Write.cpp; sourceTree = ""; }; + 7592BCEF2CBEE98C00EB74A0 /* EmberMetadata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EmberMetadata.h; sourceTree = ""; }; + 7592BCF02CBEE98C00EB74A0 /* EmberMetadata.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EmberMetadata.cpp; sourceTree = ""; }; + 7592BCF12CBEE98C00EB74A0 /* Instance.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Instance.h; sourceTree = ""; }; + 7592BCF22CBEE98C00EB74A0 /* Instance.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Instance.cpp; sourceTree = ""; }; + 7592BD092CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EmberAttributeDataBuffer.h; sourceTree = ""; }; + 7592BD0A2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EmberAttributeDataBuffer.cpp; sourceTree = ""; }; 7596A83D28751220004DAE0E /* MTRBaseClusters_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseClusters_Internal.h; sourceTree = ""; }; 7596A84228762729004DAE0E /* MTRDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDevice.h; sourceTree = ""; }; 7596A84328762729004DAE0E /* MTRDevice.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDevice.mm; sourceTree = ""; }; @@ -798,6 +835,8 @@ B2E0D7AE245B0B5C003C5B48 /* MTRQRCodeSetupPayloadParser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRQRCodeSetupPayloadParser.mm; sourceTree = ""; }; B2E0D7AF245B0B5C003C5B48 /* MTRSetupPayload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRSetupPayload.h; sourceTree = ""; }; B2E0D7B0245B0B5C003C5B48 /* MTRSetupPayload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRSetupPayload.mm; sourceTree = ""; }; + B409D0AC2CCFB89600A7ED5A /* DeviceDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceDelegate.h; sourceTree = ""; }; + B409D0AD2CCFB89600A7ED5A /* DeviceDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceDelegate.mm; sourceTree = ""; }; B43B39E42CB859A5006AA284 /* Commands.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Commands.h; sourceTree = ""; }; B43B39E52CB859A5006AA284 /* DumpMemoryGraphCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DumpMemoryGraphCommand.h; sourceTree = ""; }; B43B39E62CB859A5006AA284 /* DumpMemoryGraphCommand.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DumpMemoryGraphCommand.mm; sourceTree = ""; }; @@ -1011,6 +1050,8 @@ 037C3D9B2991BD4F00B7EEE2 /* common */ = { isa = PBXGroup; children = ( + B409D0AC2CCFB89600A7ED5A /* DeviceDelegate.h */, + B409D0AD2CCFB89600A7ED5A /* DeviceDelegate.mm */, B43B39EF2CB99090006AA284 /* CertificateIssuer.h */, B43B39F02CB99090006AA284 /* CertificateIssuer.mm */, B43B39F12CB99090006AA284 /* ControllerStorage.h */, @@ -1119,11 +1160,11 @@ 1E857311265519DE0050A4D9 /* app */ = { isa = PBXGroup; children = ( + 7521D2932CBECE3F00218E16 /* codegen-data-model-provider */, 75A202E72BA8DBB700A771DD /* reporting */, 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */, 514C79F22B62ED5500DD6D7B /* attribute-storage.cpp */, 514C79EF2B62ADDA00DD6D7B /* descriptor.cpp */, - 514C79EC2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp */, E04AC67C2BEEA17F00BA409B /* ember-global-attribute-access-interface.cpp */, E04AC67B2BEEA17F00BA409B /* ember-io-storage.cpp */, 516415FE2B6B132200D5CE11 /* DataModelHandler.cpp */, @@ -1279,6 +1320,23 @@ path = ServerEndpoint; sourceTree = ""; }; + 7521D2932CBECE3F00218E16 /* codegen-data-model-provider */ = { + isa = PBXGroup; + children = ( + 7592BD092CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h */, + 7592BD0A2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp */, + 7592BCEB2CBEE98C00EB74A0 /* CodegenDataModelProvider.h */, + 7592BCEC2CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp */, + 7592BCED2CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp */, + 7592BCEE2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp */, + 7592BCEF2CBEE98C00EB74A0 /* EmberMetadata.h */, + 7592BCF02CBEE98C00EB74A0 /* EmberMetadata.cpp */, + 7592BCF12CBEE98C00EB74A0 /* Instance.h */, + 7592BCF22CBEE98C00EB74A0 /* Instance.cpp */, + ); + path = "codegen-data-model-provider"; + sourceTree = ""; + }; 75A202E72BA8DBB700A771DD /* reporting */ = { isa = PBXGroup; children = ( @@ -1314,8 +1372,6 @@ isa = PBXGroup; children = ( D444F9A12C6E8058007761E5 /* XPC Protocol */, - 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, - 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */, 88E07D602B9A89A4005FD53E /* MTRMetricKeys.h */, 88FA798B2B7B257100CD4B6F /* MTRMetricsCollector.h */, 88FA798C2B7B257100CD4B6F /* MTRMetricsCollector.mm */, @@ -1339,6 +1395,9 @@ 7596A84728762783004DAE0E /* MTRAsyncCallbackWorkQueue.mm */, 3DA1A3522ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.h */, 3DA1A3532ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.mm */, + 514A98AC2CD98C5E000EF4FD /* MTRAttributeValueWaiter.h */, + 514A98AD2CD98C5E000EF4FD /* MTRAttributeValueWaiter.mm */, + 514A98AE2CD98C5E000EF4FD /* MTRAttributeValueWaiter_Internal.h */, 3CF134AA289D8DF70017A19E /* MTRDeviceAttestationInfo.h */, 3CF134AC289D8E570017A19E /* MTRDeviceAttestationInfo.mm */, 27A53C1527FBC6920053F131 /* MTRAttestationTrustStoreBridge.h */, @@ -1396,11 +1455,13 @@ 75B3269B2BCDB9D600E17C4E /* MTRDeviceConnectivityMonitor.h */, 75B3269D2BCDB9EA00E17C4E /* MTRDeviceConnectivityMonitor.mm */, 991DC0822475F45400C13860 /* MTRDeviceController.h */, + 5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */, + 991DC0872475F47D00C13860 /* MTRDeviceController.mm */, + 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */, + 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, 9BFE5D4E2C6D3075007D4319 /* MTRDeviceController_XPC.h */, 9B5CCB582C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h */, 9BFE5D4F2C6D3075007D4319 /* MTRDeviceController_XPC.mm */, - 5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */, - 991DC0872475F47D00C13860 /* MTRDeviceController.mm */, 5A7947E227C0101200434CF2 /* MTRDeviceController+XPC.h */, 5A7947E327C0129500434CF2 /* MTRDeviceController+XPC.mm */, 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */, @@ -1425,7 +1486,8 @@ 51565CB32A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h */, 5A6FEC9427B5976200F25F42 /* MTRDeviceControllerXPCConnection.h */, 5A6FEC9527B5983000F25F42 /* MTRDeviceControllerXPCConnection.mm */, - 5109E9BC2CC1F25C0006884B /* MTRDeviceDataValueDictionary.h */, + 5109E9BE2CCAD64F0006884B /* MTRDeviceDataValidation.h */, + 5109E9BF2CCAD64F0006884B /* MTRDeviceDataValidation.mm */, 5A6FEC8B27B5609C00F25F42 /* MTRDeviceOverXPC.h */, 5A6FEC9727B5C6AF00F25F42 /* MTRDeviceOverXPC.mm */, 754784632BFE65B70089C372 /* MTRDeviceStorageBehaviorConfiguration.h */, @@ -1664,12 +1726,14 @@ 037C3DCE2991BD5100B7EEE2 /* CHIPCommandBridge.h in Headers */, 512431272BA0C8BF000BC136 /* SetMRPParametersCommand.h in Headers */, 037C3DD22991BD5200B7EEE2 /* InteractiveCommands.h in Headers */, + 7592BD0D2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h in Headers */, 037C3DAF2991BD4F00B7EEE2 /* DeviceControllerDelegateBridge.h in Headers */, B4FCD5712B603A6300832859 /* DownloadLogCommand.h in Headers */, 037C3DC32991BD5100B7EEE2 /* Commands.h in Headers */, B4F773CA2CB54B61008C6B23 /* LeakChecker.h in Headers */, B43B39F82CB99090006AA284 /* CertificateIssuer.h in Headers */, B43B39F92CB99090006AA284 /* PreferencesStorage.h in Headers */, + B409D0AE2CCFB89600A7ED5A /* DeviceDelegate.h in Headers */, B43B39FA2CB99090006AA284 /* ControllerStorage.h in Headers */, 037C3DB82991BD5000B7EEE2 /* ClusterCommandBridge.h in Headers */, 037C3DC82991BD5100B7EEE2 /* CHIPToolKeypair.h in Headers */, @@ -1694,6 +1758,9 @@ 037C3DB72991BD5000B7EEE2 /* ModelCommandBridge.h in Headers */, 037C3DC52991BD5100B7EEE2 /* StorageManagementCommand.h in Headers */, 037C3DCC2991BD5100B7EEE2 /* MTRError_Utils.h in Headers */, + 7592BD002CBEE98C00EB74A0 /* Instance.h in Headers */, + 7592BD012CBEE98C00EB74A0 /* EmberMetadata.h in Headers */, + 7592BD022CBEE98C00EB74A0 /* CodegenDataModelProvider.h in Headers */, 037C3DAD2991BD4F00B7EEE2 /* PairingCommandBridge.h in Headers */, 037C3DBB2991BD5000B7EEE2 /* Commands.h in Headers */, 512431262BA0C8BA000BC136 /* ResetMRPParametersCommand.h in Headers */, @@ -1707,7 +1774,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 5109E9BD2CC1F25C0006884B /* MTRDeviceDataValueDictionary.h in Headers */, 51D0B1282B617246006E3511 /* MTRServerEndpoint.h in Headers */, 51565CB62A7B0D6600469F18 /* MTRDeviceControllerParameters.h in Headers */, 51565CB42A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h in Headers */, @@ -1767,12 +1833,15 @@ 516415FD2B6ACA8300D5CE11 /* MTRServerAccessControl.h in Headers */, 3CF134AB289D8DF70017A19E /* MTRDeviceAttestationInfo.h in Headers */, B2E0D7B2245B0B5C003C5B48 /* MTRManualSetupPayloadParser.h in Headers */, + 5109E9C02CCAD64F0006884B /* MTRDeviceDataValidation.h in Headers */, 3CF134A7289D8ADA0017A19E /* MTRCSRInfo.h in Headers */, 88E07D612B9A89A4005FD53E /* MTRMetricKeys.h in Headers */, 3D4733B32BE2D1DA003DC19B /* MTRUtilities.h in Headers */, B2E0D7B1245B0B5C003C5B48 /* Matter.h in Headers */, 7596A84428762729004DAE0E /* MTRDevice.h in Headers */, B2E0D7B8245B0B5C003C5B48 /* MTRSetupPayload.h in Headers */, + 514A98AF2CD98C5E000EF4FD /* MTRAttributeValueWaiter.h in Headers */, + 514A98B02CD98C5E000EF4FD /* MTRAttributeValueWaiter_Internal.h in Headers */, 1E4D654F29C208DD00BC3478 /* MTRCommissionableBrowser.h in Headers */, 3D843756294AD25A0070D20A /* MTRCertificateInfo.h in Headers */, 7596A83E28751220004DAE0E /* MTRBaseClusters_Internal.h in Headers */, @@ -1809,6 +1878,7 @@ 51E51FC0282AD37A00FC978D /* MTRDeviceControllerStartupParams_Internal.h in Headers */, 3DECCB702934AECD00585AEC /* MTRLogging.h in Headers */, 1E4D654E29C208DD00BC3478 /* MTRCommissionableBrowserResult.h in Headers */, + 7592BD0C2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.h in Headers */, 9B231B042C62EF650030EB37 /* (null) in Headers */, 515BE4ED2B72C0C5000BC1FD /* MTRUnfairLock.h in Headers */, 998F286F26D55EC5001846C6 /* MTRP256KeypairBridge.h in Headers */, @@ -1823,6 +1893,9 @@ 51D0B12E2B6177FD006E3511 /* MTRAccessGrant.h in Headers */, 5109E9B52CB8B5DF0006884B /* MTRDeviceType.h in Headers */, 1E4D655029C208DD00BC3478 /* MTRCommissionableBrowserDelegate.h in Headers */, + 7592BCF32CBEE98C00EB74A0 /* Instance.h in Headers */, + 7592BCF42CBEE98C00EB74A0 /* EmberMetadata.h in Headers */, + 7592BCF52CBEE98C00EB74A0 /* CodegenDataModelProvider.h in Headers */, 7596A84828762783004DAE0E /* MTRAsyncCallbackWorkQueue.h in Headers */, 5A7947E527C0129F00434CF2 /* MTRDeviceController+XPC.h in Headers */, 51E95DFB2A78443C00A434F0 /* MTRSessionResumptionStorageBridge.h in Headers */, @@ -1982,11 +2055,17 @@ 0395470F2992DB37006D42A8 /* complete.c in Sources */, 03F430A82994112B00166449 /* editline.c in Sources */, 03F430AA2994113500166449 /* sysunix.c in Sources */, + 7592BD0E2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp in Sources */, B45373BF2A9FEA9100807602 /* adopt.c in Sources */, B4F773CB2CB54B61008C6B23 /* LeakChecker.mm in Sources */, B45373D12A9FEB0C00807602 /* alloc.c in Sources */, B45373DD2A9FEB5300807602 /* base64-decode.c in Sources */, B45373D22A9FEB0C00807602 /* buflist.c in Sources */, + 7592BCFB2CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp in Sources */, + 7592BCFC2CBEE98C00EB74A0 /* Instance.cpp in Sources */, + 7592BCFD2CBEE98C00EB74A0 /* EmberMetadata.cpp in Sources */, + 7592BCFE2CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp in Sources */, + 7592BCFF2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp in Sources */, B45373C12A9FEA9100807602 /* close.c in Sources */, B45373D42A9FEB0C00807602 /* context.c in Sources */, B45373E52A9FEBA400807602 /* date.c in Sources */, @@ -2030,7 +2109,6 @@ 039546A62991E151006D42A8 /* InteractionModel.cpp in Sources */, B4FCD5722B603A6300832859 /* DownloadLogCommand.mm in Sources */, 75A202E62BA8DBAC00A771DD /* reporting.cpp in Sources */, - 514C79EE2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp in Sources */, 039145E82993179300257B3E /* GetCommissionerNodeIdCommand.mm in Sources */, 0395469F2991DFC5006D42A8 /* json_reader.cpp in Sources */, 514C79F42B62ED5500DD6D7B /* attribute-storage.cpp in Sources */, @@ -2055,6 +2133,7 @@ 0382FA302992F40C00247BBB /* ComplexArgumentParser.cpp in Sources */, 039145E12993102B00257B3E /* main.mm in Sources */, 037C3DD42991BD5200B7EEE2 /* logging.mm in Sources */, + B409D0AF2CCFB89600A7ED5A /* DeviceDelegate.mm in Sources */, 512431282BA0C8BF000BC136 /* SetMRPParametersCommand.mm in Sources */, 512431292BA0C8BF000BC136 /* ResetMRPParametersCommand.mm in Sources */, 037C3DB32991BD5000B7EEE2 /* OpenCommissioningWindowCommand.mm in Sources */, @@ -2085,6 +2164,11 @@ 515C1C6F284F9FFB00A48F0C /* MTRFramework.mm in Sources */, 51029DF6293AA6100087AFB0 /* MTROperationalCertificateIssuer.mm in Sources */, 27A53C1827FBC6920053F131 /* MTRAttestationTrustStoreBridge.mm in Sources */, + 7592BCF62CBEE98C00EB74A0 /* CodegenDataModelProvider_Read.cpp in Sources */, + 7592BCF72CBEE98C00EB74A0 /* Instance.cpp in Sources */, + 7592BCF82CBEE98C00EB74A0 /* EmberMetadata.cpp in Sources */, + 7592BCF92CBEE98C00EB74A0 /* CodegenDataModelProvider.cpp in Sources */, + 7592BCFA2CBEE98C00EB74A0 /* CodegenDataModelProvider_Write.cpp in Sources */, 93B2CF9A2B56E45C00E4D187 /* MTRClusterNames.mm in Sources */, 998F287126D56940001846C6 /* MTRP256KeypairBridge.mm in Sources */, 516416012B6B483C00D5CE11 /* MTRIMDispatch.mm in Sources */, @@ -2100,7 +2184,6 @@ 516415FF2B6B132200D5CE11 /* DataModelHandler.cpp in Sources */, 75139A6F2B7FE5E900E3A919 /* MTRDeviceControllerLocalTestStorage.mm in Sources */, 51E95DFC2A78443C00A434F0 /* MTRSessionResumptionStorageBridge.mm in Sources */, - 514C79ED2B62ADCD00DD6D7B /* ember-compatibility-functions.cpp in Sources */, 7534F12828BFF20300390851 /* MTRDeviceAttestationDelegate.mm in Sources */, B4C8E6B72B3453AD00FCD54D /* MTRDiagnosticLogsDownloader.mm in Sources */, 2C5EEEF7268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm in Sources */, @@ -2123,6 +2206,7 @@ 88E6C9482B6334ED001A1FE0 /* MTRMetrics.mm in Sources */, 1ED276E226C5812A00547A89 /* MTRCluster.mm in Sources */, 9BFE5D512C6D3075007D4319 /* MTRDeviceController_XPC.mm in Sources */, + 514A98B12CD98C5E000EF4FD /* MTRAttributeValueWaiter.mm in Sources */, B2E0D7B3245B0B5C003C5B48 /* MTRError.mm in Sources */, 51E51FC1282AD37A00FC978D /* MTRDeviceControllerStartupParams.mm in Sources */, 51565CAE2A79D42100469F18 /* MTRConversion.mm in Sources */, @@ -2142,6 +2226,7 @@ 5109E9B42CB8B5DF0006884B /* MTRDeviceType.mm in Sources */, 3D843757294AD25A0070D20A /* MTRCertificateInfo.mm in Sources */, 5A7947E427C0129600434CF2 /* MTRDeviceController+XPC.mm in Sources */, + 7592BD0B2CC6BCC300EB74A0 /* EmberAttributeDataBuffer.cpp in Sources */, 5A6FEC9027B563D900F25F42 /* MTRDeviceControllerOverXPC.mm in Sources */, 516415FC2B6ACA8300D5CE11 /* MTRServerAccessControl.mm in Sources */, B289D4222639C0D300D4E314 /* MTROnboardingPayloadParser.mm in Sources */, @@ -2157,6 +2242,7 @@ 7596A85528788557004DAE0E /* MTRClusters.mm in Sources */, 88EBF8CF27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.mm in Sources */, 5A6FEC9827B5C6AF00F25F42 /* MTRDeviceOverXPC.mm in Sources */, + 5109E9C12CCAD64F0006884B /* MTRDeviceDataValidation.mm in Sources */, 9BDA2A062C5D9AF800A32BDD /* MTRDevice_Concrete.mm in Sources */, 514654492A72F9DF00904E61 /* MTRDemuxingStorage.mm in Sources */, 1E4D655229C30A8700BC3478 /* MTRCommissionableBrowser.mm in Sources */, diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index 70680640b0..265f5fea7f 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -48,7 +48,6 @@ buildconfig_header("chip_buildconfig") { "CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE=${chip_log_message_max_size}", "CHIP_AUTOMATION_LOGGING=${chip_automation_logging}", "CHIP_PW_TOKENIZER_LOGGING=${chip_pw_tokenizer_logging}", - "CHIP_USE_PW_LOGGING=${chip_use_pw_logging}", "CHIP_EXCHANGE_NODE_ID_LOGGING=${chip_exchange_node_id_logging}", "CHIP_CONFIG_SHORT_ERROR_STR=${chip_config_short_error_str}", "CHIP_CONFIG_ENABLE_ARG_PARSER=${chip_config_enable_arg_parser}", @@ -71,6 +70,7 @@ buildconfig_header("chip_buildconfig") { "CHIP_CONFIG_TLV_VALIDATE_CHAR_STRING_ON_WRITE=${chip_tlv_validate_char_string_on_write}", "CHIP_CONFIG_TLV_VALIDATE_CHAR_STRING_ON_READ=${chip_tlv_validate_char_string_on_read}", "CHIP_CONFIG_COMMAND_SENDER_BUILTIN_SUPPORT_FOR_BATCHED_COMMANDS=${chip_enable_sending_batch_commands}", + "CHIP_CONFIG_TEST_GOOGLETEST=${chip_build_tests_googletest}", ] visibility = [ ":chip_config_header" ] @@ -116,6 +116,7 @@ source_set("string-builder-adapters") { public_deps = [ ":error", "$dir_pw_string", + "$dir_pw_unit_test", ] } diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 382c63497d..fca3472826 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1845,6 +1845,17 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_MAX_BDX_LOG_TRANSFERS 5 #endif // CHIP_CONFIG_MAX_BDX_LOG_TRANSFERS +/** + * @def CHIP_CONFIG_TEST_GOOGLETEST + * + * @brief + * If asserted (1), enable APIs that support unit tests built with the GoogleTest framework + * + */ +#ifndef CHIP_CONFIG_TEST_GOOGLETEST +#define CHIP_CONFIG_TEST_GOOGLETEST 0 +#endif // CHIP_CONFIG_TEST_GOOGLETEST + /** * @} */ diff --git a/src/lib/core/ErrorStr.cpp b/src/lib/core/ErrorStr.cpp index 6d83bc015b..b3cf968c67 100644 --- a/src/lib/core/ErrorStr.cpp +++ b/src/lib/core/ErrorStr.cpp @@ -29,7 +29,7 @@ namespace chip { /** * Static buffer to store the formatted error string. */ -static char sErrorStr[CHIP_CONFIG_ERROR_STR_SIZE]; +static ErrorStrStorage sErrorStr; /** * Linked-list of error formatter functions. @@ -38,7 +38,7 @@ static ErrorFormatter * sErrorFormatterList = nullptr; /** * This routine returns a human-readable NULL-terminated C string - * describing the provided error. + * describing the provided error. This uses the global static storage. * * @param[in] err The error for format and describe. * @param[in] withSourceLocation Whether or not to include the source @@ -50,8 +50,26 @@ static ErrorFormatter * sErrorFormatterList = nullptr; */ DLL_EXPORT const char * ErrorStr(CHIP_ERROR err, bool withSourceLocation) { - char * formattedError = sErrorStr; - uint16_t formattedSpace = sizeof(sErrorStr); + return ErrorStr(err, withSourceLocation, sErrorStr); +} + +/** + * This routine writess a human-readable NULL-terminated C string into the buf + * which describes the provided error. + * + * @param[in] err The error for format and describe. + * @param[in] withSourceLocation Whether or not to include the source + * @param[in] storage ErrorStrStorage to write into + * location in the output string. Only used if CHIP_CONFIG_ERROR_SOURCE && + * !CHIP_CONFIG_SHORT_ERROR_STR. Defaults to true. + * + * @return A pointer to a NULL-terminated C string describing the + * provided error. + */ +DLL_EXPORT const char * ErrorStr(CHIP_ERROR err, bool withSourceLocation, ErrorStrStorage & storage) +{ + char * formattedError = storage.buff; + uint16_t formattedSpace = storage.kBufferSize; #if CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR @@ -65,34 +83,27 @@ DLL_EXPORT const char * ErrorStr(CHIP_ERROR err, bool withSourceLocation) formattedError += n; formattedSpace = static_cast(formattedSpace - n); } - if (err == CHIP_NO_ERROR) - { - (void) snprintf(formattedError, formattedSpace, CHIP_NO_ERROR_STRING); - return sErrorStr; - } - -#else // CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR +#endif // CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR if (err == CHIP_NO_ERROR) { - return CHIP_NO_ERROR_STRING; + (void) snprintf(formattedError, formattedSpace, CHIP_NO_ERROR_STRING); + return storage.buff; } -#endif // CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR - // Search the registered error formatter for one that will format the given // error code. for (const ErrorFormatter * errFormatter = sErrorFormatterList; errFormatter != nullptr; errFormatter = errFormatter->Next) { if (errFormatter->FormatError(formattedError, formattedSpace, err)) { - return sErrorStr; + return storage.buff; } } // Use a default formatting if no formatter found. FormatError(formattedError, formattedSpace, nullptr, err, nullptr); - return sErrorStr; + return storage.buff; } /** diff --git a/src/lib/core/ErrorStr.h b/src/lib/core/ErrorStr.h index d67680c215..f1365a6bfb 100644 --- a/src/lib/core/ErrorStr.h +++ b/src/lib/core/ErrorStr.h @@ -48,7 +48,14 @@ struct ErrorFormatter ErrorFormatter * Next; }; +struct ErrorStrStorage +{ + char buff[CHIP_CONFIG_ERROR_STR_SIZE]; + constexpr static uint16_t kBufferSize = sizeof(buff); +}; + extern const char * ErrorStr(CHIP_ERROR err, bool withSourceLocation = true); +extern const char * ErrorStr(CHIP_ERROR err, bool withSourceLocation, ErrorStrStorage & storage); extern void RegisterErrorFormatter(ErrorFormatter * errFormatter); extern void DeregisterErrorFormatter(ErrorFormatter * errFormatter); extern void FormatError(char * buf, uint16_t bufSize, const char * subsys, CHIP_ERROR err, const char * desc); diff --git a/src/lib/core/StringBuilderAdapters.cpp b/src/lib/core/StringBuilderAdapters.cpp index d072c1ee90..be07ae92cf 100644 --- a/src/lib/core/StringBuilderAdapters.cpp +++ b/src/lib/core/StringBuilderAdapters.cpp @@ -29,3 +29,18 @@ StatusWithSize ToString(const CHIP_ERROR & err, pw::span buffe } } // namespace pw + +#if CHIP_CONFIG_TEST_GOOGLETEST +namespace chip { + +void PrintTo(const CHIP_ERROR & err, std::ostream * os) +{ + if (CHIP_ERROR::IsSuccess(err)) + { + *os << "CHIP_NO_ERROR"; + return; + } + *os << "CHIP_ERROR:<" << err.Format() << ">"; +} +} // namespace chip +#endif // CHIP_CONFIG_TEST_GOOGLETEST diff --git a/src/lib/core/StringBuilderAdapters.h b/src/lib/core/StringBuilderAdapters.h index f173d56b46..ad3bfb71e2 100644 --- a/src/lib/core/StringBuilderAdapters.h +++ b/src/lib/core/StringBuilderAdapters.h @@ -42,6 +42,7 @@ /// Actual: CHIP_ERROR: == CHIP_NO_ERROR #include +#include #include @@ -51,3 +52,22 @@ template <> StatusWithSize ToString(const CHIP_ERROR & err, pw::span buffer); } // namespace pw +#if CHIP_CONFIG_TEST_GOOGLETEST + +namespace chip { + +/// The following function is for usage with GoogleTest. +/// This implementation of PrintTo allows GoogleTest to print CHIP_ERROR for better logs in the event of a failure. +/// Example output with PrintTo(): +/// +/// src/lib/core/tests/TestTLV.cpp:382: Failure +/// Expected equality of these values: +/// err +/// Which is: CHIP_ERROR: +/// CHIP_ERROR(0, "src/lib/core/tests/TestTLV.cpp", 382) +/// Which is: CHIP_NO_ERROR +/// +/// This enhances the readability and diagnostic information in GoogleTest test logs. +void PrintTo(const CHIP_ERROR & err, std::ostream * os); +} // namespace chip +#endif // CHIP_CONFIG_TEST_GOOGLETEST diff --git a/src/lib/core/TLVReader.cpp b/src/lib/core/TLVReader.cpp index 8368b9fb0f..ca3da3b555 100644 --- a/src/lib/core/TLVReader.cpp +++ b/src/lib/core/TLVReader.cpp @@ -647,31 +647,18 @@ CHIP_ERROR TLVReader::Next(TLVType expectedType, Tag expectedTag) CHIP_ERROR TLVReader::Skip() { - CHIP_ERROR err; - TLVElementType elemType = ElementType(); - - if (elemType == TLVElementType::EndOfContainer) - return CHIP_END_OF_TLV; + const TLVElementType elemType = ElementType(); + VerifyOrReturnError(elemType != TLVElementType::EndOfContainer, CHIP_END_OF_TLV); if (TLVTypeIsContainer(elemType)) { TLVType outerContainerType; - err = EnterContainer(outerContainerType); - if (err != CHIP_NO_ERROR) - return err; - err = ExitContainer(outerContainerType); - if (err != CHIP_NO_ERROR) - return err; + ReturnErrorOnFailure(EnterContainer(outerContainerType)); + return ExitContainer(outerContainerType); } - else - { - err = SkipData(); - if (err != CHIP_NO_ERROR) - return err; - - ClearElementState(); - } + ReturnErrorOnFailure(SkipData()); + ClearElementState(); return CHIP_NO_ERROR; } @@ -705,8 +692,6 @@ CHIP_ERROR TLVReader::SkipData() if (TLVTypeHasLength(elemType)) { err = ReadData(nullptr, static_cast(mElemLenOrVal)); - if (err != CHIP_NO_ERROR) - return err; } return err; @@ -755,27 +740,16 @@ CHIP_ERROR TLVReader::SkipToEndOfContainer() CHIP_ERROR TLVReader::ReadElement() { - CHIP_ERROR err; - uint8_t stagingBuf[17]; // 17 = 1 control byte + 8 tag bytes + 8 length/value bytes - const uint8_t * p; - TLVElementType elemType; - // Make sure we have input data. Return CHIP_END_OF_TLV if no more data is available. - err = EnsureData(CHIP_END_OF_TLV); - if (err != CHIP_NO_ERROR) - return err; + ReturnErrorOnFailure(EnsureData(CHIP_END_OF_TLV)); + VerifyOrReturnError(mReadPoint != nullptr, CHIP_ERROR_INVALID_TLV_ELEMENT); - if (mReadPoint == nullptr) - { - return CHIP_ERROR_INVALID_TLV_ELEMENT; - } // Get the element's control byte. mControlByte = *mReadPoint; // Extract the element type from the control byte. Fail if it's invalid. - elemType = ElementType(); - if (!IsValidTLVType(elemType)) - return CHIP_ERROR_INVALID_TLV_ELEMENT; + TLVElementType elemType = ElementType(); + VerifyOrReturnError(IsValidTLVType(elemType), CHIP_ERROR_INVALID_TLV_ELEMENT); // Extract the tag control from the control byte. TLVTagControl tagControl = static_cast(mControlByte & kTLVTagControlMask); @@ -787,54 +761,40 @@ CHIP_ERROR TLVReader::ReadElement() TLVFieldSize lenOrValFieldSize = GetTLVFieldSize(elemType); // Determine the number of bytes in the length/value field. - uint8_t valOrLenBytes = TLVFieldSizeToBytes(lenOrValFieldSize); + const uint8_t valOrLenBytes = TLVFieldSizeToBytes(lenOrValFieldSize); // Determine the number of bytes in the element's 'head'. This includes: the control byte, the tag bytes (if present), the // length bytes (if present), and for elements that don't have a length (e.g. integers), the value bytes. - uint8_t elemHeadBytes = static_cast(1 + tagBytes + valOrLenBytes); + const uint8_t elemHeadBytes = static_cast(1 + tagBytes + valOrLenBytes); - // If the head of the element overlaps the end of the input buffer, read the bytes into the staging buffer - // and arrange to parse them from there. Otherwise read them directly from the input buffer. - if (elemHeadBytes > (mBufEnd - mReadPoint)) - { - err = ReadData(stagingBuf, elemHeadBytes); - if (err != CHIP_NO_ERROR) - return err; - p = stagingBuf; - } - else - { - p = mReadPoint; - mReadPoint += elemHeadBytes; - mLenRead += elemHeadBytes; - } + // 17 = 1 control byte + 8 tag bytes + 8 length/value bytes + uint8_t stagingBuf[17]; + + // Odd workaround: clang-tidy claims garbage value otherwise as it does not + // understand that ReadData initializes stagingBuf + stagingBuf[1] = 0; + + // If the head of the element goes past the end of the current input buffer, + // we need to read it into the staging buffer to parse it. Just do that unconditionally, + // even if the head does not go past end of current buffer, to save codesize. + ReturnErrorOnFailure(ReadData(stagingBuf, elemHeadBytes)); - // Skip over the control byte. - p++; + // +1 to skip over the control byte + const uint8_t * p = stagingBuf + 1; // Read the tag field, if present. - mElemTag = ReadTag(tagControl, p); + mElemTag = ReadTag(tagControl, p); + mElemLenOrVal = 0; // Read the length/value field, if present. - switch (lenOrValFieldSize) - { - case kTLVFieldSize_0Byte: - mElemLenOrVal = 0; - break; - case kTLVFieldSize_1Byte: - mElemLenOrVal = Read8(p); - break; - case kTLVFieldSize_2Byte: - mElemLenOrVal = LittleEndian::Read16(p); - break; - case kTLVFieldSize_4Byte: - mElemLenOrVal = LittleEndian::Read32(p); - break; - case kTLVFieldSize_8Byte: - mElemLenOrVal = LittleEndian::Read64(p); - VerifyOrReturnError(!TLVTypeHasLength(elemType) || (mElemLenOrVal <= UINT32_MAX), CHIP_ERROR_NOT_IMPLEMENTED); - break; - } + // NOTE: this is works because even though we only memcpy a subset of values and leave + // the rest 0. Value looks like " ... 0 0 ... 0" + // which is the TLV format. HostSwap ensures this becomes a real host value + // (should be a NOOP on LE machines, will full-swap on big-endian machines) + memcpy(&mElemLenOrVal, p, valOrLenBytes); + LittleEndian::HostSwap(mElemLenOrVal); + + VerifyOrReturnError(!TLVTypeHasLength(elemType) || (mElemLenOrVal <= UINT32_MAX), CHIP_ERROR_NOT_IMPLEMENTED); return VerifyElement(); } @@ -929,13 +889,9 @@ Tag TLVReader::ReadTag(TLVTagControl tagControl, const uint8_t *& p) const CHIP_ERROR TLVReader::ReadData(uint8_t * buf, uint32_t len) { - CHIP_ERROR err; - while (len > 0) { - err = EnsureData(CHIP_ERROR_TLV_UNDERRUN); - if (err != CHIP_NO_ERROR) - return err; + ReturnErrorOnFailure(EnsureData(CHIP_ERROR_TLV_UNDERRUN)); uint32_t remainingLen = static_cast(mBufEnd - mReadPoint); @@ -958,29 +914,17 @@ CHIP_ERROR TLVReader::ReadData(uint8_t * buf, uint32_t len) CHIP_ERROR TLVReader::EnsureData(CHIP_ERROR noDataErr) { - CHIP_ERROR err; - if (mReadPoint == mBufEnd) { - if (mLenRead == mMaxLen) - return noDataErr; - - if (mBackingStore == nullptr) - return noDataErr; + VerifyOrReturnError((mLenRead != mMaxLen) && (mBackingStore != nullptr), noDataErr); uint32_t bufLen; - err = mBackingStore->GetNextBuffer(*this, mReadPoint, bufLen); - if (err != CHIP_NO_ERROR) - return err; - if (bufLen == 0) - return noDataErr; + ReturnErrorOnFailure(mBackingStore->GetNextBuffer(*this, mReadPoint, bufLen)); + VerifyOrReturnError(bufLen > 0, noDataErr); // Cap mBufEnd so that we don't read beyond the user's specified maximum length, even // if the underlying buffer is larger. - uint32_t overallLenRemaining = mMaxLen - mLenRead; - if (overallLenRemaining < bufLen) - bufLen = overallLenRemaining; - + bufLen = std::min(bufLen, mMaxLen - mLenRead); mBufEnd = mReadPoint + bufLen; } diff --git a/src/lib/core/TLVTypes.h b/src/lib/core/TLVTypes.h index e6fb238660..06f58d3d8b 100644 --- a/src/lib/core/TLVTypes.h +++ b/src/lib/core/TLVTypes.h @@ -120,7 +120,7 @@ enum * * @return @p true if the specified TLV type is valid; otherwise @p false. */ -inline bool IsValidTLVType(TLVElementType type) +constexpr bool IsValidTLVType(TLVElementType type) { return type <= TLVElementType::EndOfContainer; } @@ -130,7 +130,7 @@ inline bool IsValidTLVType(TLVElementType type) * * @return @p true if the specified TLV type implies the presence of an associated value field; otherwise @p false. */ -inline bool TLVTypeHasValue(TLVElementType type) +constexpr bool TLVTypeHasValue(TLVElementType type) { return (type <= TLVElementType::UInt64 || (type >= TLVElementType::FloatingPointNumber32 && type <= TLVElementType::ByteString_8ByteLength)); @@ -141,7 +141,7 @@ inline bool TLVTypeHasValue(TLVElementType type) * * @return @p true if the specified TLV type implies the presence of an associated length field; otherwise @p false. */ -inline bool TLVTypeHasLength(TLVElementType type) +constexpr bool TLVTypeHasLength(TLVElementType type) { return type >= TLVElementType::UTF8String_1ByteLength && type <= TLVElementType::ByteString_8ByteLength; } @@ -186,13 +186,13 @@ inline bool TLVTypeIsUTF8String(TLVElementType type) * * @return @p true if the specified TLV type is a byte string; otherwise @p false. */ -inline bool TLVTypeIsByteString(TLVElementType type) +constexpr bool TLVTypeIsByteString(TLVElementType type) { return type >= TLVElementType::ByteString_1ByteLength && type <= TLVElementType::ByteString_8ByteLength; } // TODO: move to private namespace -inline TLVFieldSize GetTLVFieldSize(TLVElementType type) +constexpr TLVFieldSize GetTLVFieldSize(TLVElementType type) { if (TLVTypeHasValue(type)) return static_cast(static_cast(type) & kTLVTypeSizeMask); @@ -200,12 +200,18 @@ inline TLVFieldSize GetTLVFieldSize(TLVElementType type) } // TODO: move to private namespace -inline uint8_t TLVFieldSizeToBytes(TLVFieldSize fieldSize) +constexpr uint8_t TLVFieldSizeToBytes(TLVFieldSize fieldSize) { // We would like to assert fieldSize < 7, but that gives us fatal // -Wtautological-constant-out-of-range-compare warnings... return static_cast((fieldSize != kTLVFieldSize_0Byte) ? (1 << fieldSize) : 0); } +static_assert(TLVFieldSizeToBytes(kTLVFieldSize_0Byte) == 0); +static_assert(TLVFieldSizeToBytes(kTLVFieldSize_1Byte) == 1); +static_assert(TLVFieldSizeToBytes(kTLVFieldSize_2Byte) == 2); +static_assert(TLVFieldSizeToBytes(kTLVFieldSize_4Byte) == 4); +static_assert(TLVFieldSizeToBytes(kTLVFieldSize_8Byte) == 8); + } // namespace TLV } // namespace chip diff --git a/src/lib/core/TLVWriter.cpp b/src/lib/core/TLVWriter.cpp index db019fb548..aee91011bc 100644 --- a/src/lib/core/TLVWriter.cpp +++ b/src/lib/core/TLVWriter.cpp @@ -659,13 +659,13 @@ CHIP_ERROR TLVWriter::WriteElementHead(TLVElementType elemType, Tag tag, uint64_ ABORT_ON_UNINITIALIZED_IF_ENABLED(); VerifyOrReturnError(IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - if (IsContainerOpen()) - return CHIP_ERROR_TLV_CONTAINER_OPEN; + VerifyOrReturnError(!IsContainerOpen(), CHIP_ERROR_TLV_CONTAINER_OPEN); uint8_t stagingBuf[17]; // 17 = 1 control byte + 8 tag bytes + 8 length/value bytes - uint8_t * p = stagingBuf; uint32_t tagNum = TagNumFromTag(tag); + Encoding::LittleEndian::BufferWriter writer(stagingBuf, sizeof(stagingBuf)); + if (IsSpecialTag(tag)) { if (tagNum <= Tag::kContextTagMaxNum) @@ -673,8 +673,8 @@ CHIP_ERROR TLVWriter::WriteElementHead(TLVElementType elemType, Tag tag, uint64_ if (mContainerType != kTLVType_Structure && mContainerType != kTLVType_List) return CHIP_ERROR_INVALID_TLV_TAG; - Write8(p, TLVTagControl::ContextSpecific | elemType); - Write8(p, static_cast(tagNum)); + writer.Put8(TLVTagControl::ContextSpecific | elemType); + writer.Put8(static_cast(tagNum)); } else { @@ -682,7 +682,7 @@ CHIP_ERROR TLVWriter::WriteElementHead(TLVElementType elemType, Tag tag, uint64_ mContainerType != kTLVType_Array && mContainerType != kTLVType_List) return CHIP_ERROR_INVALID_TLV_TAG; - Write8(p, TLVTagControl::Anonymous | elemType); + writer.Put8(TLVTagControl::Anonymous | elemType); } } else @@ -694,28 +694,28 @@ CHIP_ERROR TLVWriter::WriteElementHead(TLVElementType elemType, Tag tag, uint64_ if (profileId == kCommonProfileId) { - if (tagNum < 65536) + if (tagNum <= std::numeric_limits::max()) { - Write8(p, TLVTagControl::CommonProfile_2Bytes | elemType); - LittleEndian::Write16(p, static_cast(tagNum)); + writer.Put8(TLVTagControl::CommonProfile_2Bytes | elemType); + writer.Put16(static_cast(tagNum)); } else { - Write8(p, TLVTagControl::CommonProfile_4Bytes | elemType); - LittleEndian::Write32(p, tagNum); + writer.Put8(TLVTagControl::CommonProfile_4Bytes | elemType); + writer.Put32(tagNum); } } else if (profileId == ImplicitProfileId) { - if (tagNum < 65536) + if (tagNum <= std::numeric_limits::max()) { - Write8(p, TLVTagControl::ImplicitProfile_2Bytes | elemType); - LittleEndian::Write16(p, static_cast(tagNum)); + writer.Put8(TLVTagControl::ImplicitProfile_2Bytes | elemType); + writer.Put16(static_cast(tagNum)); } else { - Write8(p, TLVTagControl::ImplicitProfile_4Bytes | elemType); - LittleEndian::Write32(p, tagNum); + writer.Put8(TLVTagControl::ImplicitProfile_4Bytes | elemType); + writer.Put32(tagNum); } } else @@ -723,44 +723,33 @@ CHIP_ERROR TLVWriter::WriteElementHead(TLVElementType elemType, Tag tag, uint64_ uint16_t vendorId = static_cast(profileId >> 16); uint16_t profileNum = static_cast(profileId); - if (tagNum < 65536) + if (tagNum <= std::numeric_limits::max()) { - Write8(p, TLVTagControl::FullyQualified_6Bytes | elemType); - LittleEndian::Write16(p, vendorId); - LittleEndian::Write16(p, profileNum); - LittleEndian::Write16(p, static_cast(tagNum)); + + writer.Put8(TLVTagControl::FullyQualified_6Bytes | elemType); + writer.Put16(vendorId); + writer.Put16(profileNum); + writer.Put16(static_cast(tagNum)); } else { - Write8(p, TLVTagControl::FullyQualified_8Bytes | elemType); - LittleEndian::Write16(p, vendorId); - LittleEndian::Write16(p, profileNum); - LittleEndian::Write32(p, tagNum); + writer.Put8(TLVTagControl::FullyQualified_8Bytes | elemType); + writer.Put16(vendorId); + writer.Put16(profileNum); + writer.Put32(tagNum); } } } - switch (GetTLVFieldSize(elemType)) + uint8_t lengthSize = TLVFieldSizeToBytes(GetTLVFieldSize(elemType)); + if (lengthSize > 0) { - case kTLVFieldSize_0Byte: - break; - case kTLVFieldSize_1Byte: - Write8(p, static_cast(lenOrVal)); - break; - case kTLVFieldSize_2Byte: - LittleEndian::Write16(p, static_cast(lenOrVal)); - break; - case kTLVFieldSize_4Byte: - LittleEndian::Write32(p, static_cast(lenOrVal)); - break; - case kTLVFieldSize_8Byte: - LittleEndian::Write64(p, lenOrVal); - break; + writer.EndianPut(lenOrVal, lengthSize); } - uint32_t bytesStaged = static_cast(p - stagingBuf); - VerifyOrDie(bytesStaged <= sizeof(stagingBuf)); - return WriteData(stagingBuf, bytesStaged); + size_t written = 0; + VerifyOrDie(writer.Fit(written)); + return WriteData(stagingBuf, static_cast(written)); } CHIP_ERROR TLVWriter::WriteElementWithData(TLVType type, Tag tag, const uint8_t * data, uint32_t dataLen) diff --git a/src/lib/core/core.gni b/src/lib/core/core.gni index eea73a5c56..6dd71cf64f 100644 --- a/src/lib/core/core.gni +++ b/src/lib/core/core.gni @@ -50,9 +50,6 @@ declare_args() { # Enable pigweed tokenizer logging. chip_pw_tokenizer_logging = false - # Configure chip logging to output through pigweed logging. - chip_use_pw_logging = false - # Enable logging of node Id in exchange context log messages. # Will cause increase in code size and is therefore disabled by default. chip_exchange_node_id_logging = false diff --git a/src/lib/core/tests/TestCHIPErrorStr.cpp b/src/lib/core/tests/TestCHIPErrorStr.cpp index 01130aca42..1ce158cc85 100644 --- a/src/lib/core/tests/TestCHIPErrorStr.cpp +++ b/src/lib/core/tests/TestCHIPErrorStr.cpp @@ -170,6 +170,31 @@ static const CHIP_ERROR kTestElements[] = }; // clang-format on +void CheckCoreErrorStrHelper(const char * errStr, CHIP_ERROR err) +{ + char expectedText[9]; + + // Assert that the error string contains the error number in hex. + snprintf(expectedText, sizeof(expectedText), "%08" PRIX32, static_cast(err.AsInteger())); + EXPECT_TRUE((strstr(errStr, expectedText) != nullptr)); + +#if !CHIP_CONFIG_SHORT_ERROR_STR + // Assert that the error string contains a description, which is signaled + // by a presence of a colon proceeding the description. + EXPECT_TRUE((strchr(errStr, ':') != nullptr)); +#endif // !CHIP_CONFIG_SHORT_ERROR_STR + +#if CHIP_CONFIG_ERROR_SOURCE + // GetFile() should be relative to ${chip_root} + char const * const file = err.GetFile(); + ASSERT_NE(file, nullptr); + EXPECT_EQ(strstr(file, "src/lib/core/"), file); + + // File should be included in the error. + EXPECT_NE(strstr(errStr, file), nullptr); +#endif // CHIP_CONFIG_ERROR_SOURCE +} + TEST(TestCHIPErrorStr, CheckCoreErrorStr) { // Register the layer error formatter @@ -179,29 +204,46 @@ TEST(TestCHIPErrorStr, CheckCoreErrorStr) // For each defined error... for (const auto & err : kTestElements) { - const char * errStr = ErrorStr(err); - char expectedText[9]; + // ErrorStr with static char array. + CheckCoreErrorStrHelper(ErrorStr(err, /*withSourceLocation=*/true), err); + } +} + +TEST(TestCHIPErrorStr, CheckCoreErrorStrStorage) +{ + // Register the layer error formatter + + RegisterCHIPLayerErrorFormatter(); + + // For each defined error... + for (const auto & err : kTestElements) + { + // ErrorStr with given storage. + ErrorStrStorage storage; + CheckCoreErrorStrHelper(ErrorStr(err, /*withSourceLocation=*/true, storage), err); + } +} + +void CheckCoreErrorStrWithoutSourceLocationHelper(const char * errStr, CHIP_ERROR err) +{ + char expectedText[9]; - // Assert that the error string contains the error number in hex. - snprintf(expectedText, sizeof(expectedText), "%08" PRIX32, static_cast(err.AsInteger())); - EXPECT_TRUE((strstr(errStr, expectedText) != nullptr)); + // Assert that the error string contains the error number in hex. + snprintf(expectedText, sizeof(expectedText), "%08" PRIX32, static_cast(err.AsInteger())); + EXPECT_TRUE((strstr(errStr, expectedText) != nullptr)); #if !CHIP_CONFIG_SHORT_ERROR_STR - // Assert that the error string contains a description, which is signaled - // by a presence of a colon proceeding the description. - EXPECT_TRUE((strchr(errStr, ':') != nullptr)); + // Assert that the error string contains a description, which is signaled + // by a presence of a colon proceeding the description. + EXPECT_TRUE((strchr(errStr, ':') != nullptr)); #endif // !CHIP_CONFIG_SHORT_ERROR_STR #if CHIP_CONFIG_ERROR_SOURCE - // GetFile() should be relative to ${chip_root} - char const * const file = err.GetFile(); - ASSERT_NE(file, nullptr); - EXPECT_EQ(strstr(file, "src/lib/core/"), file); - - // File should be included in the error. - EXPECT_NE(strstr(errStr, file), nullptr); + char const * const file = err.GetFile(); + ASSERT_NE(file, nullptr); + // File should not be included in the error. + EXPECT_EQ(strstr(errStr, file), nullptr); #endif // CHIP_CONFIG_ERROR_SOURCE - } } TEST(TestCHIPErrorStr, CheckCoreErrorStrWithoutSourceLocation) @@ -213,24 +255,22 @@ TEST(TestCHIPErrorStr, CheckCoreErrorStrWithoutSourceLocation) // For each defined error... for (const auto & err : kTestElements) { - const char * errStr = ErrorStr(err, /*withSourceLocation=*/false); - char expectedText[9]; + // ErrorStr with static char array. + CheckCoreErrorStrWithoutSourceLocationHelper(ErrorStr(err, /*withSourceLocation=*/false), err); + } +} - // Assert that the error string contains the error number in hex. - snprintf(expectedText, sizeof(expectedText), "%08" PRIX32, static_cast(err.AsInteger())); - EXPECT_TRUE((strstr(errStr, expectedText) != nullptr)); +TEST(TestCHIPErrorStr, CheckCoreErrorStrStorageWithoutSourceLocation) +{ + // Register the layer error formatter -#if !CHIP_CONFIG_SHORT_ERROR_STR - // Assert that the error string contains a description, which is signaled - // by a presence of a colon proceeding the description. - EXPECT_TRUE((strchr(errStr, ':') != nullptr)); -#endif // !CHIP_CONFIG_SHORT_ERROR_STR + RegisterCHIPLayerErrorFormatter(); -#if CHIP_CONFIG_ERROR_SOURCE - char const * const file = err.GetFile(); - ASSERT_NE(file, nullptr); - // File should not be included in the error. - EXPECT_EQ(strstr(errStr, file), nullptr); -#endif // CHIP_CONFIG_ERROR_SOURCE + // For each defined error... + for (const auto & err : kTestElements) + { + // ErrorStr with given storage. + ErrorStrStorage storage; + CheckCoreErrorStrWithoutSourceLocationHelper(ErrorStr(err, /*withSourceLocation=*/false, storage), err); } } diff --git a/src/lib/shell/MainLoopSilabs.cpp b/src/lib/shell/MainLoopSilabs.cpp index 8a8d60af2d..8613c48b55 100644 --- a/src/lib/shell/MainLoopSilabs.cpp +++ b/src/lib/shell/MainLoopSilabs.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "matter_shell.h" +#include "MatterShell.h" #include "streamer.h" #include #include diff --git a/src/lib/support/BufferWriter.h b/src/lib/support/BufferWriter.h index 64c22af21b..ad47425151 100644 --- a/src/lib/support/BufferWriter.h +++ b/src/lib/support/BufferWriter.h @@ -87,28 +87,8 @@ class BufferWriter uint8_t * Buffer() { return mBuf; } const uint8_t * Buffer() const { return mBuf; } - BufferWriter & Format(const char * format, ...) ENFORCE_FORMAT(2, 3) - { - va_list args; - va_start(args, format); - VFormat(format, args); - va_end(args); - return *this; - } - void Reset() { mNeeded = 0; } - /// Since this uses vsnprintf internally, on overflow - /// this will write one less byte that strictly can be - /// written (since null terminator will be in the binary data) - BufferWriter & VFormat(const char * format, va_list args) ENFORCE_FORMAT(2, 0); - - /// Assume a specific size for the buffer instead of mSize - /// - /// This is to allow avoiding off-by-one overflow truncation - /// when we know the underlying buffer size is larger. - BufferWriter & VFormatWithSize(size_t size, const char * format, va_list args) ENFORCE_FORMAT(3, 0); - protected: uint8_t * mBuf; size_t mSize; diff --git a/src/lib/support/pw_log_chip/BUILD.gn b/src/lib/support/pw_log_chip/BUILD.gn deleted file mode 100644 index 23695fa505..0000000000 --- a/src/lib/support/pw_log_chip/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2020 The Pigweed 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 -# -# https://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("//build_overrides/chip.gni") -import("//build_overrides/pigweed.gni") - -import("$dir_pw_build/target_types.gni") - -config("config") { - include_dirs = [ - "public", - "public_overrides", - ] -} - -pw_source_set("pw_log_chip") { - public_configs = [ ":config" ] - public_deps = [ ":pw_log_chip.impl" ] - public = [ "public_overrides/pw_log_backend/log_backend.h" ] - sources = [ "public/pw_log_chip/log_chip.h" ] -} - -pw_source_set("pw_log_chip.impl") { - public_deps = [ "${chip_root}/src/lib/support" ] -} diff --git a/src/lib/support/pw_log_chip/public/pw_log_chip/log_chip.h b/src/lib/support/pw_log_chip/public/pw_log_chip/log_chip.h deleted file mode 100644 index 6550ec7070..0000000000 --- a/src/lib/support/pw_log_chip/public/pw_log_chip/log_chip.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2020 Project CHIP Authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * This header redirects Pigweed logging prints to chip. - */ -#pragma once - -#include - -#include "pw_preprocessor/arguments.h" - -/** - * Redirect pigweed log prints to chip logging. - * Currently does not use a log module, but this could be added when needed. - * pigweed debug and info level logs are mapped to chip's kLogCategory_Detail. - * All other log levels are mapped to chip's kLogCategory_Error. - * - * Note: This function should not be called directly, instead call the functions - * in pw_log/log.h. - * - * @param[in] level Pigweed log level. - * @param[in] flags Pigweed logging flags, currently these are ignored. - * @param[in] message The printf style log string. - */ -#define PW_LOG(level, flags, message, ...) \ - do \ - { \ - if (level >= PW_LOG_LEVEL_INFO) \ - { \ - ::chip::Logging::Log(::chip::Logging::kLogModule_NotSpecified, \ - (level <= PW_LOG_LEVEL_INFO) ? ::chip::Logging::kLogCategory_Detail \ - : ::chip::Logging::kLogCategory_Error, \ - message PW_COMMA_ARGS(__VA_ARGS__)); \ - } \ - } while (0) diff --git a/src/lib/support/tests/ExtraPwTestMacros.h b/src/lib/support/tests/ExtraPwTestMacros.h index ab59280071..6eda462f80 100644 --- a/src/lib/support/tests/ExtraPwTestMacros.h +++ b/src/lib/support/tests/ExtraPwTestMacros.h @@ -17,8 +17,9 @@ */ #pragma once -/* +/** * Run Fixture's class function as a test. + * * It is used to execute test cases that need to use private members of a particular class. * Unlike the pigweed macro `FRIEND_TEST`, this approach allows you to define the entire * test_fixture class as a friend, rather than having to define each testcase as a friend. @@ -54,3 +55,16 @@ test_name(); \ } \ void test_fixture::test_name() + +/** + * Run Fixture's class function as a test. + * + * This macro does not define the body of the test function. It can be used to + * run a single test case which needs to be run against different fixtures. + * + */ +#define TEST_F_FROM_FIXTURE_NO_BODY(test_fixture, test_name) \ + TEST_F(test_fixture, test_name) \ + { \ + test_name(); \ + } diff --git a/src/lib/support/tests/TestErrorStr.cpp b/src/lib/support/tests/TestErrorStr.cpp index 809d69b302..ac8a9f5e9e 100644 --- a/src/lib/support/tests/TestErrorStr.cpp +++ b/src/lib/support/tests/TestErrorStr.cpp @@ -121,6 +121,13 @@ TEST(TestErrorStr, CheckNoError) EXPECT_STREQ(CHECK_AND_SKIP_SOURCE(ErrorStr(CHIP_NO_ERROR)), CHIP_NO_ERROR_STRING); } +TEST(TestErrorStr, CheckErrorWithProvidedStorage) +{ + ErrorStrStorage storage; + EXPECT_STREQ(CHECK_AND_SKIP_SOURCE(ErrorStr(CHIP_NO_ERROR, true, storage)), CHIP_NO_ERROR_STRING); + EXPECT_STREQ(CHECK_AND_SKIP_SOURCE(ErrorStr(CHIP_ERROR_INTERNAL, true, storage)), "Error 0x000000AC"); +} + TEST(TestErrorStr, CheckFormatErr) { #if CHIP_CONFIG_SHORT_ERROR_STR diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn index ca08a8c392..78657a635a 100644 --- a/src/lwip/BUILD.gn +++ b/src/lwip/BUILD.gn @@ -219,7 +219,7 @@ if (current_os == "zephyr" || current_os == "mbed") { } else if (lwip_platform == "cc32xx") { public_deps += [ "${ti_simplelink_sdk_build_root}:ti_simplelink_sdk" ] } else if (lwip_platform == "silabs") { - public_deps += [ "${efr32_sdk_build_root}:efr32_sdk" ] + public_deps += [ "${silabs_sdk_build_root}:silabs_sdk" ] sources += [ "${lwip_platform}/lwipopts-rs911x.h", diff --git a/src/lwip/lwip.gni b/src/lwip/lwip.gni index 89b4808af8..cbbf0a4f74 100644 --- a/src/lwip/lwip.gni +++ b/src/lwip/lwip.gni @@ -14,7 +14,8 @@ declare_args() { # Have the lwIP library available. - chip_with_lwip = current_os != "zephyr" && current_os != "mbed" + chip_with_lwip = current_os != "zephyr" && current_os != "mbed" && + current_os != "mac" && current_os != "ios" # lwIP platform: standalone, freertos. lwip_platform = "" diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index a12750c6a4..653d523970 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -36,7 +36,9 @@ #include "esp_mac.h" #endif #include "esp_ota_ops.h" +#ifndef CONFIG_IDF_TARGET_ESP32P4 #include "esp_phy_init.h" +#endif #include "esp_wifi.h" #include "nvs.h" #include "nvs_flash.h" diff --git a/src/platform/ESP32/OpenthreadLauncher.cpp b/src/platform/ESP32/OpenthreadLauncher.cpp index 63f1bac825..0ab3dadf68 100644 --- a/src/platform/ESP32/OpenthreadLauncher.cpp +++ b/src/platform/ESP32/OpenthreadLauncher.cpp @@ -40,12 +40,14 @@ #include #endif -static esp_netif_t * openthread_netif = NULL; -static esp_openthread_platform_config_t * s_platform_config = NULL; -static TaskHandle_t cli_transmit_task = NULL; -static QueueHandle_t cli_transmit_task_queue = NULL; +static esp_netif_t * openthread_netif = nullptr; +static esp_openthread_platform_config_t * s_platform_config = nullptr; +static TaskHandle_t cli_transmit_task = nullptr; +static QueueHandle_t cli_transmit_task_queue = nullptr; +static TaskHandle_t openthread_task = nullptr; static constexpr uint16_t OTCLI_TRANSMIT_TASK_STACK_SIZE = 1024; static constexpr UBaseType_t OTCLI_TRANSMIT_TASK_PRIORITY = 5; +static const char * TAG = "OpenThread"; CHIP_ERROR cli_transmit_task_post(std::unique_ptr && cli_str) { @@ -116,6 +118,14 @@ static esp_err_t cli_command_transmit_task(void) return ESP_OK; } +static void cli_command_transmit_task_delete(void) +{ + if (cli_transmit_task) + { + vTaskDelete(cli_transmit_task); + } +} + static esp_netif_t * init_openthread_netif(const esp_openthread_platform_config_t * config) { esp_netif_config_t cfg = ESP_NETIF_DEFAULT_OPENTHREAD(); @@ -141,7 +151,6 @@ static void ot_task_worker(void * context) #if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP) static constexpr size_t kRcpVersionMaxSize = 100; -static const char * TAG = "RCP_UPDATE"; static void update_rcp(void) { @@ -230,7 +239,15 @@ esp_err_t openthread_init_stack(void) }; ESP_ERROR_CHECK(esp_netif_init()); - ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config)); + esp_err_t err = esp_vfs_eventfd_register(&eventfd_config); + if (err == ESP_ERR_INVALID_STATE) + { + ESP_LOGW(TAG, "eventfd is already registered"); + } + else if (err != ESP_OK) + { + return err; + } assert(s_platform_config); // Initialize the OpenThread stack ESP_ERROR_CHECK(esp_openthread_init(s_platform_config)); @@ -248,6 +265,24 @@ esp_err_t openthread_init_stack(void) esp_err_t openthread_launch_task(void) { - xTaskCreate(ot_task_worker, "ot_task", CONFIG_THREAD_TASK_STACK_SIZE, xTaskGetCurrentTaskHandle(), 5, NULL); + xTaskCreate(ot_task_worker, "ot_task", CONFIG_THREAD_TASK_STACK_SIZE, xTaskGetCurrentTaskHandle(), 5, &openthread_task); return ESP_OK; } + +esp_err_t openthread_deinit_stack(void) +{ + esp_openthread_netif_glue_deinit(); + esp_netif_destroy(openthread_netif); +#ifdef CONFIG_OPENTHREAD_CLI + cli_command_transmit_task_delete(); +#endif + return esp_openthread_deinit(); +} + +void openthread_delete_task(void) +{ + if (openthread_task) + { + vTaskDelete(openthread_task); + } +} diff --git a/src/platform/ESP32/OpenthreadLauncher.h b/src/platform/ESP32/OpenthreadLauncher.h index a15125f948..daeebd153c 100644 --- a/src/platform/ESP32/OpenthreadLauncher.h +++ b/src/platform/ESP32/OpenthreadLauncher.h @@ -29,4 +29,6 @@ esp_err_t openthread_init_br_rcp(const esp_rcp_update_config_t * update_config); esp_err_t set_openthread_platform_config(esp_openthread_platform_config_t * config); esp_err_t openthread_init_stack(void); esp_err_t openthread_launch_task(void); +esp_err_t openthread_deinit_stack(void); +void openthread_delete_task(void); CHIP_ERROR cli_transmit_task_post(std::unique_ptr && cli_str); diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index ff48f5d9d6..176fd81ee9 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -48,7 +48,9 @@ #include #include +#ifndef CONFIG_IDF_TARGET_ESP32P4 #include "esp_bt.h" +#endif #include "esp_log.h" #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) @@ -1021,6 +1023,11 @@ CHIP_ERROR BLEManagerImpl::DeinitBLE() return MapBLEError(err); } +#ifdef CONFIG_IDF_TARGET_ESP32P4 +// Stub function to avoid link error +extern "C" void ble_transport_ll_deinit(void) {} +#endif + CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) { CHIP_ERROR err; diff --git a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHost.cpp b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHost.cpp index f33058f8e9..0332b687fc 100644 --- a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHost.cpp +++ b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHost.cpp @@ -838,7 +838,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -854,7 +854,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le result = mbedtls_ecp_group_load(&curve, MBEDTLS_ECP_DP_SECP256R1); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1in), w1in_len); + result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1sin), w1sin_len); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); result = mbedtls_mpi_mod_mpi(&w1_bn, &w1_bn, &curve.N); diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index 35b5047c9f..7961b3d648 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -22,10 +22,6 @@ import("${chip_root}/src/platform/device.gni") assert(chip_device_platform == "linux") -if (chip_use_pw_logging) { - import("//build_overrides/pigweed.gni") -} - if (chip_enable_openthread) { import("//build_overrides/openthread.gni") import("//build_overrides/ot_br_posix.gni") @@ -141,10 +137,6 @@ static_library("Linux") { public_deps += [ "dbus/openthread" ] } - if (chip_use_pw_logging) { - deps += [ "$dir_pw_log" ] - } - if (chip_enable_wifi) { sources += [ "NetworkCommissioningWiFiDriver.cpp" ] @@ -162,9 +154,5 @@ source_set("logging") { "${chip_root}/src/platform/logging:headers", ] - if (chip_use_pw_logging) { - deps += [ "$dir_pw_log" ] - } - sources = [ "Logging.cpp" ] } diff --git a/src/platform/Linux/Logging.cpp b/src/platform/Linux/Logging.cpp index 25e132e1a1..8a247f5e84 100644 --- a/src/platform/Linux/Logging.cpp +++ b/src/platform/Linux/Logging.cpp @@ -12,10 +12,6 @@ #include #include -#if CHIP_USE_PW_LOGGING -#include -#endif // CHIP_USE_PW_LOGGING - namespace chip { namespace DeviceLayer { @@ -43,7 +39,6 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) // indicate the error occurred during getting time. gettimeofday(&tv, nullptr); -#if !CHIP_USE_PW_LOGGING // Lock standard output, so a single log line will not be corrupted in case // where multiple threads are using logging subsystem at the same time. flockfile(stdout); @@ -55,30 +50,6 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) fflush(stdout); funlockfile(stdout); -#else // !CHIP_USE_PW_LOGGING - char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - snprintf(formattedMsg, sizeof(formattedMsg), - "[%" PRIu64 ".%06" PRIu64 "][%lld:%lld] CHIP:%s: ", static_cast(tv.tv_sec), - static_cast(tv.tv_usec), static_cast(syscall(SYS_getpid)), - static_cast(syscall(SYS_gettid)), module); - size_t len = strnlen(formattedMsg, sizeof(formattedMsg)); - vsnprintf(formattedMsg + len, sizeof(formattedMsg) - len, msg, v); - - switch (static_cast(category)) - { - case kLogCategory_Error: - PW_LOG_ERROR("%s", formattedMsg); - break; - case kLogCategory_Progress: - PW_LOG_INFO("%s", formattedMsg); - break; - case kLogCategory_Detail: - case kLogCategory_None: - case kLogCategory_Automation: - PW_LOG_DEBUG("%s", formattedMsg); - break; - } -#endif // !CHIP_USE_PW_LOGGING // Let the application know that a log message has been emitted. DeviceLayer::OnLogOutput(); diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index dba3cb447d..ce33209e74 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -274,9 +274,13 @@ void PlatformManagerImpl::_Shutdown() Internal::GenericPlatformManagerImpl_POSIX::_Shutdown(); #if CHIP_DEVICE_CONFIG_WITH_GLIB_MAIN_LOOP - g_main_loop_quit(mGLibMainLoop); - g_thread_join(mGLibMainLoopThread); - g_main_loop_unref(mGLibMainLoop); + if (mGLibMainLoop != nullptr) + { + g_main_loop_quit(mGLibMainLoop); + g_thread_join(mGLibMainLoopThread); + g_main_loop_unref(mGLibMainLoop); + mGLibMainLoop = nullptr; + } #endif } diff --git a/src/platform/NuttX/BUILD.gn b/src/platform/NuttX/BUILD.gn index 346c7d60ed..65113454ee 100644 --- a/src/platform/NuttX/BUILD.gn +++ b/src/platform/NuttX/BUILD.gn @@ -22,10 +22,6 @@ import("${chip_root}/src/platform/device.gni") assert(chip_device_platform == "linux" || chip_device_platform == "nuttx") -if (chip_use_pw_logging) { - import("//build_overrides/pigweed.gni") -} - if (chip_enable_openthread) { import("//build_overrides/openthread.gni") import("//build_overrides/ot_br_posix.gni") @@ -156,9 +152,5 @@ source_set("logging") { "${chip_root}/src/platform/logging:headers", ] - if (chip_use_pw_logging) { - deps += [ "$dir_pw_log" ] - } - sources = [ "Logging.cpp" ] } diff --git a/src/platform/NuttX/Logging.cpp b/src/platform/NuttX/Logging.cpp index ea95fdc4fb..6d92a2ba54 100644 --- a/src/platform/NuttX/Logging.cpp +++ b/src/platform/NuttX/Logging.cpp @@ -12,10 +12,6 @@ #include #include -#if CHIP_USE_PW_LOGGING -#include -#endif // CHIP_USE_PW_LOGGING - namespace chip { namespace DeviceLayer { @@ -43,7 +39,6 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) // indicate the error occurred during getting time. gettimeofday(&tv, nullptr); -#if !CHIP_USE_PW_LOGGING // Lock standard output, so a single log line will not be corrupted in case // where multiple threads are using logging subsystem at the same time. flockfile(stdout); @@ -55,30 +50,6 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) fflush(stdout); funlockfile(stdout); -#else // !CHIP_USE_PW_LOGGING - char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - snprintf(formattedMsg, sizeof(formattedMsg), - "[%" PRIu64 ".%06" PRIu64 "][%lld:%lld] CHIP:%s: ", static_cast(tv.tv_sec), - static_cast(tv.tv_usec), static_cast(syscall(SYS_getpid)), - static_cast(syscall(SYS_gettid)), module); - size_t len = strnlen(formattedMsg, sizeof(formattedMsg)); - vsnprintf(formattedMsg + len, sizeof(formattedMsg) - len, msg, v); - - switch (static_cast(category)) - { - case kLogCategory_Error: - PW_LOG_ERROR("%s", formattedMsg); - break; - case kLogCategory_Progress: - PW_LOG_INFO("%s", formattedMsg); - break; - case kLogCategory_Detail: - case kLogCategory_None: - case kLogCategory_Automation: - PW_LOG_DEBUG("%s", formattedMsg); - break; - } -#endif // !CHIP_USE_PW_LOGGING // Let the application know that a log message has been emitted. DeviceLayer::OnLogOutput(); diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp index 0c1d482f84..fe5bd40a0a 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp @@ -189,6 +189,7 @@ void GenericThreadDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * c status = Status::kUnknownError; } +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT if (status == Status::kSuccess && ThreadStackMgrImpl().IsThreadAttached()) { Thread::OperationalDataset currentDataset; @@ -206,6 +207,7 @@ void GenericThreadDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * c status = Status::kUnknownError; } } +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT if (status == Status::kSuccess && DeviceLayer::ThreadStackMgrImpl().AttachToThreadNetwork(mStagingNetwork, callback) != CHIP_NO_ERROR) diff --git a/src/platform/android/BUILD.gn b/src/platform/android/BUILD.gn index 640b524900..9893907f85 100644 --- a/src/platform/android/BUILD.gn +++ b/src/platform/android/BUILD.gn @@ -64,8 +64,6 @@ static_library("android") { "BleConnectCallback-JNI.cpp", "BlePlatformConfig.h", "CHIPDevicePlatformEvent.h", - "CHIPP256KeypairBridge.cpp", - "CHIPP256KeypairBridge.h", "CommissionableDataProviderImpl.cpp", "CommissionableDataProviderImpl.h", "ConfigurationManagerImpl.cpp", diff --git a/src/platform/android/java/chip/platform/AndroidBleManager.java b/src/platform/android/java/chip/platform/AndroidBleManager.java index 52b0052d40..1ca0256223 100644 --- a/src/platform/android/java/chip/platform/AndroidBleManager.java +++ b/src/platform/android/java/chip/platform/AndroidBleManager.java @@ -89,6 +89,7 @@ private static class BleMtuDenylist { private static final int MSG_BLE_SCAN = 0; private static final int MSG_BLE_CONNECT = 1; private static final int MSG_BLE_CONNECT_SUCCESS = 2; + private static final int MSG_BLE_CONNECT_RETRY = 3; private static final int MSG_BLE_FAIL = 99; private static final int BLE_TIMEOUT_MS = 10000; @@ -501,7 +502,10 @@ public void handleMessage(Message msg) { break; case MSG_BLE_CONNECT: stopBleScan(); - connectBLE(msg.obj); + connectBLE(new ConnectionGattCallback((BluetoothDevice) msg.obj)); + break; + case MSG_BLE_CONNECT_RETRY: + connectBLE((ConnectionGattCallback) msg.obj); break; case MSG_BLE_CONNECT_SUCCESS: bleConnectSuccess(msg.obj); @@ -567,20 +571,16 @@ private void stopBleScan() { } } - private void connectBLE(Object bluetoothDeviceObj) { - if (bluetoothDeviceObj == null) { - return; - } - + private void connectBLE(ConnectionGattCallback callback) { // Fail Timer reset. mConnectionHandler.removeMessages(MSG_BLE_FAIL); mConnectionHandler.sendEmptyMessageDelayed(MSG_BLE_FAIL, BLE_TIMEOUT_MS); @SuppressWarnings("unchecked") - BluetoothDevice device = (BluetoothDevice) bluetoothDeviceObj; + BluetoothDevice device = callback.getTargetDevice(); Log.i(TAG, "Connecting"); - BluetoothGatt gatt = device.connectGatt(mContext, false, new ConnectionGattCallback()); + device.connectGatt(mContext, false, callback, BluetoothDevice.TRANSPORT_LE); } class ConnectionGattCallback extends AndroidBluetoothGattCallback { @@ -588,7 +588,22 @@ class ConnectionGattCallback extends AndroidBluetoothGattCallback { private static final int STATE_DISCOVER_SERVICE = 2; private static final int STATE_REQUEST_MTU = 3; + /// Unfortunately GATT 133 is very generic, however among other things + /// it may also show up on device out of range or BLE being closed due to + /// background task termination, hence it is a candidate to retry connectivity. + private static final int kGattRetryableErrorStatus = 133; + private int mState = STATE_INIT; + private BluetoothDevice mDevice; + private int connectRetriesLeft = 3; + + public ConnectionGattCallback(BluetoothDevice device) { + mDevice = device; + } + + public BluetoothDevice getTargetDevice() { + return mDevice; + } @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { @@ -599,9 +614,27 @@ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState mState = STATE_DISCOVER_SERVICE; gatt.discoverServices(); return; - } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { + } + + if (newState == BluetoothProfile.STATE_DISCONNECTED + && status == kGattRetryableErrorStatus + && connectRetriesLeft-- > 0) { + Log.i(TAG, "Retries left: " + connectRetriesLeft + ". Retrying connect..."); + + gatt.close(); + + Message msg = mConnectionHandler.obtainMessage(); + msg.what = MSG_BLE_CONNECT_RETRY; + msg.obj = (Object) this; + mConnectionHandler.sendMessage(msg); + + return; + } + + if (newState == BluetoothProfile.STATE_DISCONNECTED) { Log.i(TAG, "Services Disconnected"); } + mConnectionHandler.sendEmptyMessage(MSG_BLE_FAIL); } diff --git a/src/platform/logging/BUILD.gn b/src/platform/logging/BUILD.gn index eb3c62154c..e415448a7f 100644 --- a/src/platform/logging/BUILD.gn +++ b/src/platform/logging/BUILD.gn @@ -12,10 +12,6 @@ group("default") { if (chip_logging_backend == "platform") { deps = [] - if (chip_use_pw_logging) { - deps += [ "$dir_pw_log" ] - } - if (chip_device_platform == "cyw30739") { deps += [ "${chip_root}/src/platform/Infineon/CYW30739:logging" ] } else if (chip_device_platform == "psoc6") { diff --git a/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h b/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h index c4e77e87b4..1cdb064459 100644 --- a/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h +++ b/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h @@ -27,6 +27,29 @@ // ==================== Platform Adaptations ==================== +#ifdef CONFIG_CHIP_USE_GENERATED_CONFIG +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID CONFIG_CHIP_DEVICE_VENDOR_ID +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME CONFIG_CHIP_DEVICE_VENDOR_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID CONFIG_CHIP_DEVICE_PRODUCT_ID +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME CONFIG_CHIP_DEVICE_PRODUCT_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION CONFIG_CHIP_DEVICE_HARDWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION CONFIG_CHIP_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_TEST_MANUFACTURING_DATE CONFIG_CHIP_DEVICE_MANUFACTURING_DATE +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE CONFIG_CHIP_DEVICE_TYPE +#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_ITERATION_COUNT CONFIG_CHIP_DEVICE_SPAKE2_IT +#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_SALT CONFIG_CHIP_DEVICE_SPAKE2_SALT +#define CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_VERIFIER CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER + +#if !CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR CONFIG_CHIP_DEVICE_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE +#define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE CONFIG_CHIP_DEVICE_USE_TEST_PAIRING_CODE +#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER CONFIG_CHIP_DEVICE_SERIAL_NUMBER +#endif // CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +#endif // CONFIG_CHIP_USE_GENERATED_CONFIG + #ifndef CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION #if CONFIG_CHIP_WIFI || CHIP_DEVICE_CONFIG_ENABLE_WPA #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 @@ -39,12 +62,16 @@ #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP -#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD -#define CHIP_DEVICE_CONFIG_ENABLE_UNPROVISIONED_MDNS 1 -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD - #ifndef CHIP_DEVICE_CONFIG_ENABLE_THREAD +#ifdef CONFIG_NET_L2_OPENTHREAD +#define CHIP_DEVICE_CONFIG_ENABLE_THREAD CONFIG_NET_L2_OPENTHREAD +#else #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 0 +#endif // CONFIG_NET_L2_OPENTHREAD +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD + +#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD +#define CHIP_DEVICE_CONFIG_ENABLE_UNPROVISIONED_MDNS 1 #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD #ifndef CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h b/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h index c90619bddd..5bbc7ef7c5 100644 --- a/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h +++ b/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h @@ -254,6 +254,15 @@ #define CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS 10 #endif +/* Increasing the retransmission interval of the MRP messages after subsequent failures */ +#ifndef CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL +#ifdef CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL +#else +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32) +#endif // CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL +#endif // CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL + #ifndef NXP_USE_MML /* Do not use Memory Manager Light for dynamic memory allocation by default. */ #define NXP_USE_MML 0 diff --git a/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp b/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp index f1f35937d8..ca93f091cf 100644 --- a/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp @@ -144,6 +144,8 @@ Status NXPWiFiDriver::RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDeb { outDebugText.reduce_size(0); outNetworkIndex = 0; + VerifyOrReturnError(NetworkMatch(mStagingNetwork, networkId), Status::kNetworkIDNotFound); + // Use empty ssid for representing invalid network mStagingNetwork.ssidLen = 0; diff --git a/src/platform/nxp/common/ble/BLEManagerCommon.cpp b/src/platform/nxp/common/ble/BLEManagerCommon.cpp index 6078fa80ac..baba33ecda 100644 --- a/src/platform/nxp/common/ble/BLEManagerCommon.cpp +++ b/src/platform/nxp/common/ble/BLEManagerCommon.cpp @@ -40,7 +40,7 @@ #include "stdio.h" #include "timers.h" -#if defined(CPU_JN518X) && defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(CPU_JN518X) && defined(nxp_use_low_power) && (nxp_use_low_power == 1) #include "PWR_Configuration.h" #endif @@ -54,7 +54,7 @@ *******************************************************************************/ extern "C" bool_t Ble_ConfigureHostStackConfig(void); -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) extern "C" void PWR_DisallowDeviceToSleep(void); extern "C" void PWR_AllowDeviceToSleep(void); #endif @@ -127,7 +127,7 @@ TimerHandle_t connectionTimeout; const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) static bool bleAppStopInProgress; #endif @@ -192,7 +192,7 @@ CHIP_ERROR BLEManagerCommon::_Init() VerifyOrExit(eventBits & CHIP_BLE_KW_EVNT_POWER_LEVEL_SET, err = CHIP_ERROR_INCORRECT_STATE); #endif -#if defined(CPU_JN518X) && defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(CPU_JN518X) && defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_ChangeDeepSleepMode(cPWR_PowerDown_RamRet); #endif @@ -516,7 +516,7 @@ BLEManagerCommon::ble_err_t BLEManagerCommon::blekw_start_advertising(gapAdverti return BLE_E_START_ADV; } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_DisallowDeviceToSleep(); #endif @@ -524,13 +524,13 @@ BLEManagerCommon::ble_err_t BLEManagerCommon::blekw_start_advertising(gapAdverti CHIP_BLE_KW_EVNT_TIMEOUT); if (!(eventBits & CHIP_BLE_KW_EVNT_ADV_CHANGED)) { -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_AllowDeviceToSleep(); #endif return BLE_E_START_ADV_FAILED; } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_AllowDeviceToSleep(); #endif @@ -927,7 +927,7 @@ void BLEManagerCommon::HandleConnectEvent(blekw_msg_t * msg) uint8_t deviceId = msg->data.u8; ChipLogProgress(DeviceLayer, "BLE is connected with device: %d.\n", deviceId); -#if gClkUseFro32K && defined(chip_with_low_power) && (chip_with_low_power == 1) +#if gClkUseFro32K && defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_DisallowDeviceToSleep(); #endif @@ -950,7 +950,7 @@ void BLEManagerCommon::HandleConnectionCloseEvent(blekw_msg_t * msg) uint8_t deviceId = msg->data.u8; ChipLogProgress(DeviceLayer, "BLE is disconnected with device: %d.\n", deviceId); -#if gClkUseFro32K && defined(chip_with_low_power) && (chip_with_low_power == 1) +#if gClkUseFro32K && defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_AllowDeviceToSleep(); #endif @@ -1088,7 +1088,7 @@ void BLEManagerCommon::HandleForceDisconnect() } } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_AllowDeviceToSleep(); #endif } @@ -1190,8 +1190,8 @@ void BLEManagerCommon::blekw_gap_connection_cb(deviceId_t deviceId, gapConnectio if (pConnectionEvent->eventType == gConnEvtConnected_c) { -#if CHIP_DEVICE_K32W1 -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if NXP_DEVICE_K32W1_MCXW7X +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) /* Disallow must be called here for K32W1, otherwise an assert will be reached. * Disclaimer: this is a workaround until a better cross platform solution is found. */ PWR_DisallowDeviceToSleep(); @@ -1207,7 +1207,7 @@ void BLEManagerCommon::blekw_gap_connection_cb(deviceId_t deviceId, gapConnectio /* Notify App Task that the BLE is connected now */ (void) blekw_msg_add_u8(BLE_KW_MSG_CONNECTED, (uint8_t) deviceId); -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) PWR_AllowDeviceToSleep(); #endif } @@ -1218,7 +1218,7 @@ void BLEManagerCommon::blekw_gap_connection_cb(deviceId_t deviceId, gapConnectio /* Notify App Task that the BLE is disconnected now */ (void) blekw_msg_add_u8(BLE_KW_MSG_DISCONNECTED, (uint8_t) deviceId); -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) if (bleAppStopInProgress == TRUE) { bleAppStopInProgress = FALSE; @@ -1454,7 +1454,7 @@ CHIP_ERROR BLEManagerCommon::blekw_stop_connection_internal(BLE_CONNECTION_OBJEC ChipLogProgress(DeviceLayer, "Gap_Disconnect() failed."); return CHIP_ERROR_INTERNAL; } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) else { bleAppStopInProgress = TRUE; diff --git a/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp b/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp index 9c6334bded..e23453eb97 100644 --- a/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/nxp/common/crypto/CHIPCryptoPALTinyCrypt.cpp @@ -1051,7 +1051,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -1061,7 +1061,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le uECC_word_t w1_bn[NUM_ECC_WORDS]; uECC_word_t L_tmp[2 * NUM_ECC_WORDS]; - uECC_vli_bytesToNative(tmp, w1in, NUM_ECC_BYTES); + uECC_vli_bytesToNative(tmp, w1sin, NUM_ECC_BYTES); uECC_vli_mmod(w1_bn, tmp, curve_n); diff --git a/src/platform/nxp/common/crypto/CHIPCryptoPalS200.cpp b/src/platform/nxp/common/crypto/CHIPCryptoPalS200.cpp index 6e9342658c..21e76c69d7 100644 --- a/src/platform/nxp/common/crypto/CHIPCryptoPalS200.cpp +++ b/src/platform/nxp/common/crypto/CHIPCryptoPalS200.cpp @@ -1138,13 +1138,13 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { secEcp256Status_t result; ecp256Point_t gen_point; uint32_t W1[SEC_ECP256_COORDINATE_WLEN]; - result = ECP256_ModularReductionN(W1, w1in, w1in_len); + result = ECP256_ModularReductionN(W1, w1sin, w1sin_len); VerifyOrReturnError(result == gSecEcp256Success_c, CHIP_ERROR_INTERNAL); result = ECP256_GeneratePublicKey((uint8_t *) &gen_point, (uint8_t *) &W1, NULL); diff --git a/src/platform/nxp/crypto/se05x/CHIPCryptoPALHost.cpp b/src/platform/nxp/crypto/se05x/CHIPCryptoPALHost.cpp index ffc626c201..68a38a98f4 100644 --- a/src/platform/nxp/crypto/se05x/CHIPCryptoPALHost.cpp +++ b/src/platform/nxp/crypto/se05x/CHIPCryptoPALHost.cpp @@ -712,7 +712,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -728,7 +728,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le result = mbedtls_ecp_group_load(&curve, MBEDTLS_ECP_DP_SECP256R1); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); - result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1in), w1in_len); + result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1sin), w1sin_len); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); result = mbedtls_mpi_mod_mpi(&w1_bn, &w1_bn, &curve.N); diff --git a/src/platform/nxp/crypto/se05x/CHIPCryptoPALHsm_se05x_spake2p.cpp b/src/platform/nxp/crypto/se05x/CHIPCryptoPALHsm_se05x_spake2p.cpp index 84216185a6..ee2bb79b1a 100644 --- a/src/platform/nxp/crypto/se05x/CHIPCryptoPALHsm_se05x_spake2p.cpp +++ b/src/platform/nxp/crypto/se05x/CHIPCryptoPALHsm_se05x_spake2p.cpp @@ -283,8 +283,8 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginVerifier(const uint8_t * my_id #if ENABLE_SE05X_SPAKE_PROVER CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, size_t peer_identity_len, - const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, - size_t w1in_len) + const uint8_t * w0sin, size_t w0sin_len, const uint8_t * w1sin, + size_t w1sin_len) { smStatus_t smstatus = SM_NOT_OK; uint8_t w0in_mod[32] = { @@ -296,8 +296,8 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_iden }; size_t w1in_mod_len = 32; - VerifyOrReturnError(w0in != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(w1in != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(w0sin != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(w1sin != nullptr, CHIP_ERROR_INVALID_ARGUMENT); if (my_identity_len > 0) { VerifyOrReturnError(my_identity != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -311,9 +311,9 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_iden ChipLogProgress(Crypto, "SE05x: HSM - BeginProver"); - ReturnErrorOnFailure(FELoad(w0in, w0in_len, w0)); + ReturnErrorOnFailure(FELoad(w0sin, w0sin_len, w0)); ReturnErrorOnFailure(FEWrite(w0, w0in_mod, w0in_mod_len)); - ReturnErrorOnFailure(FELoad(w1in, w1in_len, w1)); + ReturnErrorOnFailure(FELoad(w1sin, w1sin_len, w1)); ReturnErrorOnFailure(FEWrite(w1, w1in_mod, w1in_mod_len)); ReturnErrorOnFailure(create_init_crypto_obj(chip::Crypto::CHIP_SPAKE2P_ROLE::PROVER, &hsm_pake_context)); diff --git a/src/platform/nxp/k32w0/BLEManagerImpl.cpp b/src/platform/nxp/k32w0/BLEManagerImpl.cpp index aa56e06a8d..8dc8c45bc2 100644 --- a/src/platform/nxp/k32w0/BLEManagerImpl.cpp +++ b/src/platform/nxp/k32w0/BLEManagerImpl.cpp @@ -19,7 +19,7 @@ /* this file behaves like a config.h, comes first */ #include -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) #include "PWR_Configuration.h" #include "PWR_Interface.h" #endif @@ -79,7 +79,7 @@ CHIP_ERROR BLEManagerImpl::InitHostController(BLECallbackDelegate::GapGenericCal /* Called by BLE when a connect is received */ void BLEManagerImpl::BLE_SignalFromISRCallback(void) { -#if defined(chip_with_low_power) +#if defined(nxp_use_low_power) PWR_DisallowDeviceToSleep(); #endif } diff --git a/src/platform/nxp/k32w0/BUILD.gn b/src/platform/nxp/k32w0/BUILD.gn index 6693acc213..c7a1c94ddb 100644 --- a/src/platform/nxp/k32w0/BUILD.gn +++ b/src/platform/nxp/k32w0/BUILD.gn @@ -67,7 +67,7 @@ static_library("nxp_platform") { "${chip_root}/src/platform/nxp/k32w0/BLEManagerImpl.h", ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { sources += [ "FactoryDataProvider.cpp", "FactoryDataProviderImpl.cpp", @@ -78,7 +78,7 @@ static_library("nxp_platform") { ] } - if (chip_with_low_power != 0) { + if (nxp_use_low_power) { sources += [ "LowPowerHooks.cpp" ] } @@ -92,15 +92,14 @@ static_library("nxp_platform") { "../common/ota/OTATlvProcessor.h", ] - if (chip_enable_ota_firmware_processor == 1) { + if (nxp_enable_ota_firmware_processor) { sources += [ "OTAFirmwareProcessor.cpp", "OTAFirmwareProcessor.h", "OTAHooks.cpp", ] - if (chip_with_factory_data == 1 && - chip_enable_ota_factory_data_processor == 1) { + if (nxp_use_factory_data && nxp_enable_ota_factory_data_processor) { sources += [ "OTAFactoryDataProcessor.cpp", "OTAFactoryDataProcessor.h", diff --git a/src/platform/nxp/k32w0/LowPowerHooks.cpp b/src/platform/nxp/k32w0/LowPowerHooks.cpp index b01854c964..55c05733d2 100644 --- a/src/platform/nxp/k32w0/LowPowerHooks.cpp +++ b/src/platform/nxp/k32w0/LowPowerHooks.cpp @@ -20,7 +20,7 @@ * Provides a glue layer between Matter and NXP-SDK Low Power */ -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) #include #include diff --git a/src/platform/nxp/k32w0/PlatformManagerImpl.cpp b/src/platform/nxp/k32w0/PlatformManagerImpl.cpp index 1a98552cb7..b79de9635a 100644 --- a/src/platform/nxp/k32w0/PlatformManagerImpl.cpp +++ b/src/platform/nxp/k32w0/PlatformManagerImpl.cpp @@ -56,7 +56,7 @@ namespace DeviceLayer { PlatformManagerImpl PlatformManagerImpl::sInstance; -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) extern "C" void InitLowPower(); #endif @@ -97,7 +97,7 @@ CHIP_ERROR PlatformManagerImpl::InitBoardFwk(void) BOARD_ADCWakeupInit(); #endif -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) /* Low Power Init */ InitLowPower(); #endif diff --git a/src/platform/nxp/k32w0/ThreadStackManagerImpl.cpp b/src/platform/nxp/k32w0/ThreadStackManagerImpl.cpp index c74c2a9af4..36c27a1516 100644 --- a/src/platform/nxp/k32w0/ThreadStackManagerImpl.cpp +++ b/src/platform/nxp/k32w0/ThreadStackManagerImpl.cpp @@ -36,7 +36,7 @@ #include -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) extern "C" bool isThreadInitialized(); #endif @@ -75,7 +75,7 @@ void ThreadStackManagerImpl::ProcessThreadActivity() auto * bleManager = &chip::DeviceLayer::Internal::BLEMgrImpl(); bleManager->DoBleProcessing(); -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) if (isThreadInitialized()) #endif { diff --git a/src/platform/nxp/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp b/src/platform/nxp/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp index 8b30cdd0ce..25aa5313ec 100644 --- a/src/platform/nxp/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp +++ b/src/platform/nxp/k32w0/crypto/CHIPCryptoPALNXPUltrafastP256.cpp @@ -1017,7 +1017,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; @@ -1026,7 +1026,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le uint32_t W1[SEC_ECP256_COORDINATE_WLEN]; do { - result = ECP256_ModularReductionN(W1, w1in, w1in_len); + result = ECP256_ModularReductionN(W1, w1sin, w1sin_len); if (result != gSecEcp256Success_c) break; ecp256Point_t gen_point; diff --git a/src/platform/nxp/mcxw71_k32w1/BUILD.gn b/src/platform/nxp/mcxw71_k32w1/BUILD.gn index 6b399a1c1d..865475d1e4 100644 --- a/src/platform/nxp/mcxw71_k32w1/BUILD.gn +++ b/src/platform/nxp/mcxw71_k32w1/BUILD.gn @@ -26,8 +26,7 @@ import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") assert(chip_device_platform == "nxp") assert(nxp_platform == "mcxw71_k32w1") -assert(chip_with_low_power == 0 || - (chip_with_low_power == 1 && chip_with_ot_cli == 0), +assert(!nxp_use_low_power || (nxp_use_low_power && !nxp_enable_ot_cli), "Please disable low power if openthread CLI is needed!") source_set("nxp_factory_data") { @@ -64,8 +63,7 @@ source_set("nxp_ota") { "../common/ota/OTATlvProcessor.h", ] - if (chip_with_factory_data == 1 && - chip_enable_ota_factory_data_processor == 1) { + if (nxp_use_factory_data && nxp_enable_ota_factory_data_processor) { sources += [ "../common/ota/OTAFactoryDataProcessor.cpp", "../common/ota/OTAFactoryDataProcessor.h", @@ -91,7 +89,7 @@ config("nxp_platform_config") { static_library("nxp_platform") { deps = [] defines = [ - "CHIP_DEVICE_K32W1=1", + "NXP_DEVICE_K32W1_MCXW7X=1", "NXP_USE_MML=1", ] @@ -114,7 +112,7 @@ static_library("nxp_platform") { "SystemTimeSupport.cpp", ] - if (chip_key_storage == "fwk_nvm") { + if (nxp_nvm_component == "fwk_nvm") { defines += [ "CHIP_PLAT_NVM_SUPPORT=1" ] sources += [ @@ -125,7 +123,7 @@ static_library("nxp_platform") { "ram_storage.c", "ram_storage.h", ] - } else if (chip_key_storage == "littlefs") { + } else if (nxp_nvm_component == "littlefs") { defines += [ "CHIP_PLAT_NVM_SUPPORT=3", "EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER=\"platform/nxp/common/KeyValueStoreManagerImpl.h\"", @@ -137,7 +135,7 @@ static_library("nxp_platform") { "../common/NXPConfig.h", "../common/NXPConfigKS.cpp", ] - } else if (chip_key_storage == "nvs") { + } else if (nxp_nvm_component == "nvs") { defines += [ "gAppNvsExternalFlash_c=0", "gAppNvsInternalFlash_c=1", @@ -152,7 +150,7 @@ static_library("nxp_platform") { ] } - if (chip_use_plain_dac_key) { + if (nxp_use_plain_dac_key) { defines += [ "CHIP_USE_PLAIN_DAC_KEY=1" ] } else { defines += [ "CHIP_USE_PLAIN_DAC_KEY=0" ] @@ -170,7 +168,7 @@ static_library("nxp_platform") { public_deps = [ "${chip_root}/src/platform:platform_base" ] - if (chip_with_low_power != 0) { + if (nxp_use_low_power) { sources += [ "LowPowerHooks.cpp" ] } @@ -181,7 +179,7 @@ static_library("nxp_platform") { "../common/crypto/PersistentStorageOpKeystoreS200.h", ] - if (chip_with_ot_cli == 1) { + if (nxp_enable_ot_cli) { defines += [ "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1" ] } } @@ -205,7 +203,7 @@ static_library("nxp_platform") { deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] } - if (use_smu2_dynamic) { + if (nxp_use_smu2_dynamic) { sources += [ "SMU2Manager.cpp", "SMU2Manager.h", diff --git a/src/platform/nxp/mcxw71_k32w1/LowPowerHooks.cpp b/src/platform/nxp/mcxw71_k32w1/LowPowerHooks.cpp index bc849b476e..acec00b4ad 100644 --- a/src/platform/nxp/mcxw71_k32w1/LowPowerHooks.cpp +++ b/src/platform/nxp/mcxw71_k32w1/LowPowerHooks.cpp @@ -20,7 +20,7 @@ * Provides a glue layer between Matter and NXP-SDK Low Power */ -#if defined(chip_with_low_power) && (chip_with_low_power == 1) +#if defined(nxp_use_low_power) && (nxp_use_low_power == 1) #include #include diff --git a/src/platform/nxp/mcxw71_k32w1/args.gni b/src/platform/nxp/mcxw71_k32w1/args.gni index 68e1cdeeec..7ec8fdf3d5 100644 --- a/src/platform/nxp/mcxw71_k32w1/args.gni +++ b/src/platform/nxp/mcxw71_k32w1/args.gni @@ -16,22 +16,12 @@ import("//build_overrides/chip.gni") import("//build_overrides/nxp_sdk.gni") import("//build_overrides/openthread.gni") -declare_args() { - chip_with_ot_cli = 0 - chip_with_low_power = 0 - - # The key storage solution. Developers can select between "littlefs", "nvs" - # and the older "fwk_nvm". - chip_key_storage = "nvs" - - chip_use_plain_dac_key = false -} - openthread_root = "//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread" nxp_platform = "mcxw71_k32w1" nxp_sdk_name = "mcxw71_k32w1_sdk" nxp_device_layer = "nxp/${nxp_platform}" +nxp_nvm_component = "nvs" nxp_use_lwip = false # ARM architecture flags will be set based on NXP board. diff --git a/src/platform/nxp/rt/rt1060/BUILD.gn b/src/platform/nxp/rt/rt1060/BUILD.gn index 1e3d8f1e1e..36db659103 100644 --- a/src/platform/nxp/rt/rt1060/BUILD.gn +++ b/src/platform/nxp/rt/rt1060/BUILD.gn @@ -38,7 +38,7 @@ config("nxp_platform_config") { ".", "../../common", ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ ".", "../../common/factory_data", @@ -165,7 +165,7 @@ static_library("nxp_platform") { } } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { sources += [ "../../common/factory_data/FactoryDataProvider.cpp", "../../common/factory_data/FactoryDataProvider.h", diff --git a/src/platform/nxp/rt/rt1170/BUILD.gn b/src/platform/nxp/rt/rt1170/BUILD.gn index 4bfd1034a7..0017fc44eb 100644 --- a/src/platform/nxp/rt/rt1170/BUILD.gn +++ b/src/platform/nxp/rt/rt1170/BUILD.gn @@ -38,7 +38,7 @@ config("nxp_platform_config") { ".", "../../common", ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ ".", "../../common/factory_data", @@ -168,7 +168,7 @@ static_library("nxp_platform") { } } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { sources += [ "../../common/factory_data/FactoryDataProvider.cpp", "../../common/factory_data/FactoryDataProvider.h", diff --git a/src/platform/nxp/rt/rw61x/BUILD.gn b/src/platform/nxp/rt/rw61x/BUILD.gn index 7ac204e92c..13c2b3c2ff 100644 --- a/src/platform/nxp/rt/rw61x/BUILD.gn +++ b/src/platform/nxp/rt/rw61x/BUILD.gn @@ -42,7 +42,7 @@ config("nxp_platform_config") { ".", "../../common", ] - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { include_dirs += [ ".", "../../common/factory_data", @@ -52,14 +52,14 @@ config("nxp_platform_config") { "CONFIG_CHIP_ENCRYPTED_FACTORY_DATA=1", ] - if (chip_enable_secure_dac_private_key_storage) { - assert(chip_enable_secure_dac_private_key_storage && - !chip_enable_secure_whole_factory_data, + if (nxp_enable_secure_dac_private_key_storage) { + assert(nxp_enable_secure_dac_private_key_storage && + !nxp_enable_secure_whole_factory_data, "please select only one protection solution") defines += [ "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/rt/rw61x/FactoryDataProviderImpl.h\"" ] - } else if (chip_enable_secure_whole_factory_data) { - assert(chip_enable_secure_whole_factory_data && - !chip_enable_secure_dac_private_key_storage, + } else if (nxp_enable_secure_whole_factory_data) { + assert(nxp_enable_secure_whole_factory_data && + !nxp_enable_secure_dac_private_key_storage, "please select only one protection solution") defines += [ "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/rt/rw61x/FactoryDataProviderEncImpl.h\"" ] } else { @@ -196,17 +196,17 @@ static_library("nxp_platform") { } } - if (chip_with_factory_data == 1) { + if (nxp_use_factory_data) { sources += [ "../../common/factory_data/FactoryDataProvider.cpp", "../../common/factory_data/FactoryDataProvider.h", ] - if (chip_enable_secure_dac_private_key_storage) { + if (nxp_enable_secure_dac_private_key_storage) { sources += [ "FactoryDataProviderImpl.cpp", "FactoryDataProviderImpl.h", ] - } else if (chip_enable_secure_whole_factory_data) { + } else if (nxp_enable_secure_whole_factory_data) { sources += [ "FactoryDataProviderEncImpl.cpp", "FactoryDataProviderEncImpl.h", diff --git a/src/platform/silabs/BLEManagerImpl.h b/src/platform/silabs/BLEManagerImpl.h index 9380accce3..6c639a7a77 100644 --- a/src/platform/silabs/BLEManagerImpl.h +++ b/src/platform/silabs/BLEManagerImpl.h @@ -27,13 +27,7 @@ #include "FreeRTOS.h" #include "timers.h" #if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE) -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus #include "wfx_sl_ble_init.h" -#ifdef __cplusplus -} -#endif // __cplusplus #else #include "gatt_db.h" #include "sl_bgapi.h" @@ -68,6 +62,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla int32_t SendBLEAdvertisementCommand(void); #else void HandleConnectEvent(volatile sl_bt_msg_t * evt); + void HandleConnectParams(volatile sl_bt_msg_t * evt); void HandleConnectionCloseEvent(volatile sl_bt_msg_t * evt); void HandleWriteEvent(volatile sl_bt_msg_t * evt); void UpdateMtu(volatile sl_bt_msg_t * evt); diff --git a/src/platform/silabs/CHIPDevicePlatformEvent.h b/src/platform/silabs/CHIPDevicePlatformEvent.h index 8ab1e21b45..090ada6403 100644 --- a/src/platform/silabs/CHIPDevicePlatformEvent.h +++ b/src/platform/silabs/CHIPDevicePlatformEvent.h @@ -26,7 +26,7 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION -#include "wfx_host_events.h" +#include #endif namespace chip { diff --git a/src/platform/silabs/ConfigurationManagerImpl.cpp b/src/platform/silabs/ConfigurationManagerImpl.cpp index b4dd5c9c52..3a144eb116 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/ConfigurationManagerImpl.cpp @@ -31,7 +31,7 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION -#include "wfx_host_events.h" +#include #endif namespace chip { @@ -290,10 +290,10 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) PersistedStorage::KeyValueStoreMgrImpl().ErasePartition(); #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION - sl_status_t status = wfx_sta_discon(); + sl_status_t status = sl_matter_wifi_disconnect(); if (status != SL_STATUS_OK) { - ChipLogError(DeviceLayer, "wfx_sta_discon() failed: %lx", status); + ChipLogError(DeviceLayer, "sl_matter_wifi_disconnect() failed: %lx", status); } ChipLogProgress(DeviceLayer, "Clearing WiFi provision"); wfx_clear_wifi_provision(); diff --git a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp index 6e5470f7d0..0d9d63317e 100644 --- a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp @@ -40,7 +40,7 @@ #endif #include "CHIPDevicePlatformConfig.h" -#include "wfx_host_events.h" +#include using namespace ::chip; using namespace ::chip::Inet; @@ -277,7 +277,7 @@ void ConnectivityManagerImpl::DriveStationState() (mWiFiStationMode != kWiFiStationMode_Enabled && !IsWiFiStationProvisioned())) { ChipLogProgress(DeviceLayer, "Disconnecting WiFi station interface"); - serr = wfx_sta_discon(); + serr = sl_matter_wifi_disconnect(); if (serr != SL_STATUS_OK) { ChipLogError(DeviceLayer, "wfx_wifi_disconnect() failed: %lx", serr); diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp index 7f6240c32c..ba80a94be6 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp @@ -140,7 +140,7 @@ CHIP_ERROR SlWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, if (ConnectivityMgr().IsWiFiStationProvisioned()) { ChipLogProgress(DeviceLayer, "Disconecting for current wifi"); - status = wfx_sta_discon(); + status = sl_matter_wifi_disconnect(); if (status != SL_STATUS_OK) { return CHIP_ERROR_INTERNAL; diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.h b/src/platform/silabs/NetworkCommissioningWiFiDriver.h index f152edb343..12986b9987 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.h +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.h @@ -18,7 +18,7 @@ #pragma once #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/silabs/PlatformManagerImpl.cpp b/src/platform/silabs/PlatformManagerImpl.cpp index dccb5db765..b3d7f80052 100644 --- a/src/platform/silabs/PlatformManagerImpl.cpp +++ b/src/platform/silabs/PlatformManagerImpl.cpp @@ -84,10 +84,10 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); SuccessOrExit(err); -#if CHIP_SYSTEM_CONFIG_USE_LWIP +#if CHIP_SYSTEM_CONFIG_USE_LWIP && !defined(SLI_SI91X_MCU_INTERFACE) // Initialize LwIP. tcpip_init(NULL, NULL); -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP && !defined(SLI_SI91X_MCU_INTERFACE) ReturnErrorOnFailure(System::Clock::InitClock_RealTime()); @@ -135,9 +135,17 @@ void PlatformManagerImpl::_Shutdown() Internal::GenericPlatformManagerImpl_CMSISOS::_Shutdown(); } +} // namespace DeviceLayer +} // namespace chip + #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION -void PlatformManagerImpl::HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData) +// This function needs to be global so it can be used from the platform implementation without depending on the platfrom itself. +// This is a workaround to avoid a circular dependency. +void HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData) { + using namespace chip; + using namespace chip::DeviceLayer; + ChipDeviceEvent event; memset(&event, 0, sizeof(event)); event.Type = DeviceEventType::kWFXSystemEvent; @@ -200,9 +208,7 @@ void PlatformManagerImpl::HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wf } } - (void) sInstance.PostEvent(&event); + // TODO: We should add error processing here + (void) PlatformMgr().PostEvent(&event); } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION - -} // namespace DeviceLayer -} // namespace chip diff --git a/src/platform/silabs/PlatformManagerImpl.h b/src/platform/silabs/PlatformManagerImpl.h index 1abbb9f07f..dddc491384 100644 --- a/src/platform/silabs/PlatformManagerImpl.h +++ b/src/platform/silabs/PlatformManagerImpl.h @@ -26,10 +26,14 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION -#include "wfx_host_events.h" +#include #endif #include +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION +void HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData); +#endif + namespace chip { namespace DeviceLayer { @@ -62,9 +66,6 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener public: // ===== Platform-specific members that may be accessed directly by the application. -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION - void HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData); -#endif System::Clock::Timestamp GetStartTime() { return mStartTime; } diff --git a/src/platform/silabs/SiWx917/BUILD.gn b/src/platform/silabs/SiWx917/BUILD.gn index 188f1f3396..826d8accd9 100644 --- a/src/platform/silabs/SiWx917/BUILD.gn +++ b/src/platform/silabs/SiWx917/BUILD.gn @@ -18,7 +18,7 @@ import("${chip_root}/src/platform/device.gni") import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/src/crypto/crypto.gni") -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") import("${chip_root}/third_party/silabs/silabs_board.gni") @@ -30,10 +30,14 @@ if (chip_crypto == "platform") { import("//build_overrides/mbedtls.gni") } -config("siwx917-platform-wifi-config") { - include_dirs = [ "wifi" ] - defines = [] +source_set("logging") { + sources = [ "${chip_root}/src/platform/silabs/Logging.cpp" ] + deps = [ + "${chip_root}/src/platform:platform_base", + "${chip_root}/src/platform/logging:headers", + ] } + static_library("SiWx917") { sources = [ "${silabs_platform_dir}/BLEManagerImpl.h", @@ -45,6 +49,7 @@ static_library("SiWx917") { "${silabs_platform_dir}/ConfigurationManagerImpl.cpp", "${silabs_platform_dir}/ConfigurationManagerImpl.h", "${silabs_platform_dir}/ConnectivityManagerImpl.h", + "${silabs_platform_dir}/ConnectivityManagerImpl_WIFI.cpp", "${silabs_platform_dir}/DiagnosticDataProviderImpl.cpp", "${silabs_platform_dir}/DiagnosticDataProviderImpl.h", "${silabs_platform_dir}/InetPlatformConfig.h", @@ -52,6 +57,8 @@ static_library("SiWx917") { "${silabs_platform_dir}/KeyValueStoreManagerImpl.h", "${silabs_platform_dir}/MigrationManager.cpp", "${silabs_platform_dir}/MigrationManager.h", + "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.cpp", + "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.h", "${silabs_platform_dir}/PlatformManagerImpl.cpp", "${silabs_platform_dir}/PlatformManagerImpl.h", "${silabs_platform_dir}/SilabsConfig.cpp", @@ -66,6 +73,7 @@ static_library("SiWx917") { "../rs911x/rsi_ble_config.h", "../rs911x/wfx_sl_ble_init.cpp", "../rs911x/wfx_sl_ble_init.h", + "SiWxPlatformInterface.h", ] if (chip_enable_ota_requestor) { @@ -94,24 +102,7 @@ static_library("SiWx917") { public_deps += [ "${chip_root}/src/crypto", "${mbedtls_root}:mbedtls", + "${silabs_platform_dir}/wifi:wifi-platform", ] } - - sources += [ - "${silabs_platform_dir}/ConnectivityManagerImpl_WIFI.cpp", - "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.cpp", - "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.h", - "${silabs_platform_dir}/wifi/wfx_host_events.h", - "wifi/wfx_msgs.h", - "wifi/wifi_config.h", - ] - public_configs = [ ":siwx917-platform-wifi-config" ] -} - -source_set("logging") { - sources = [ "${chip_root}/src/platform/silabs/Logging.cpp" ] - deps = [ - "${chip_root}/src/platform:platform_base", - "${chip_root}/src/platform/logging:headers", - ] } diff --git a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp index 05fa10c583..b8278b359d 100644 --- a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp @@ -1070,7 +1070,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -1080,7 +1080,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le uECC_word_t w1_bn[NUM_ECC_WORDS]; uECC_word_t L_tmp[2 * NUM_ECC_WORDS]; - uECC_vli_bytesToNative(tmp, w1in, NUM_ECC_BYTES); + uECC_vli_bytesToNative(tmp, w1sin, NUM_ECC_BYTES); uECC_vli_mmod(w1_bn, tmp, curve_n); diff --git a/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp b/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp index bccb704ad1..bce64cbac8 100644 --- a/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp @@ -20,8 +20,8 @@ #include #include -#include "wfx_host_events.h" #include +#include #ifdef __cplusplus extern "C" { #endif diff --git a/src/platform/silabs/SiWx917/SiWxPlatformInterface.h b/src/platform/silabs/SiWx917/SiWxPlatformInterface.h new file mode 100644 index 0000000000..8589db3b3f --- /dev/null +++ b/src/platform/silabs/SiWx917/SiWxPlatformInterface.h @@ -0,0 +1,111 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#if SLI_SI91X_MCU_INTERFACE +#include "sl_si91x_button.h" +#include "sl_si91x_button_pin_config.h" +#include "sl_si91x_driver_gpio.h" + +/** + * @brief invoked when button press event is received when in sleep + * @param[in] pin_intr GPIO pin interrupt number. + * @return none. + * @note this is a callback from the Wiseconnect SDK + */ +void gpio_uulp_pin_interrupt_callback(uint32_t pin_intr) +{ + // UULP_GPIO_2 is used to detect the button 0 press + VerifyOrReturn(pin_intr == RTE_UULP_GPIO_2_PIN, ChipLogError(DeviceLayer, "invalid pin interrupt: %ld", pin_intr)); + sl_status_t status = SL_STATUS_OK; + uint8_t pin_intr_status = sl_si91x_gpio_get_uulp_npss_pin(pin_intr); + if (pin_intr_status == LOW) + { + // BTN_0 is pressed + // NOTE: the GPIO is masked since the interrupt is invoked before scheduler is started, thus this is required to hand over + // control to scheduler, the PIN is unmasked in the power manager flow before going to sleep + status = sl_si91x_gpio_driver_mask_uulp_npss_interrupt(BIT(pin_intr)); + VerifyOrReturn(status == SL_STATUS_OK, ChipLogError(DeviceLayer, "failed to mask interrupt: %ld", status)); + } +} + +#endif // SLI_SI91X_MCU_INTERFACE +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER +#ifdef __cplusplus +} +#endif + +namespace chip { +namespace DeviceLayer { +namespace Silabs { +namespace SiWxPlatformInterface { + +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#if SLI_SI91X_MCU_INTERFACE +/** + * @brief Required to invoke button press event during sleep as falling edge is not detected + * @param[in] none. + * @note flow is GPIO wakeup due to BTN0 press -> check button state in idle task required as the GPIO interrupt is not + * detected during sleep for BUTTON RELEASED + */ +inline void sl_si91x_btn_event_handler() +{ + sl_button_on_change(SL_BUTTON_BTN0_NUMBER, + (sl_si91x_gpio_get_uulp_npss_pin(SL_BUTTON_BTN0_PIN) == LOW) ? BUTTON_PRESSED : BUTTON_RELEASED); +} + +/** + * @brief Required to enable MATTER shell UART with ICD feature flag + * @param[in] none. + * @note this requires hardware jumping of the GPIO PINs to work with the baseboard. + */ +void sl_si91x_uart_power_requirement_handler() +{ +#ifdef ENABLE_CHIP_SHELL + // Checking the UULP PIN 1 status to reinit the UART and not allow the device to go to sleep + if (sl_si91x_gpio_get_uulp_npss_pin(RTE_UULP_GPIO_1_PIN)) + { + if (!ps_requirement_added) + { + sl_si91x_power_manager_add_ps_requirement(SL_SI91X_POWER_MANAGER_PS4); + ps_requirement_added = true; + } + } + else + { + if (ps_requirement_added) + { + sl_si91x_power_manager_remove_ps_requirement(SL_SI91X_POWER_MANAGER_PS4); + ps_requirement_added = false; + } + } +#endif // ENABLE_CHIP_SHELL +} + +#endif // SLI_SI91X_MCU_INTERFACE +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER +} // namespace SiWxPlatformInterface +} // namespace Silabs +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp deleted file mode 100644 index 2860b895ce..0000000000 --- a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Includes */ - -#include -#include -#include - -#include "wfx_host_events.h" -#include "wifi_config.h" -#ifdef __cplusplus -extern "C" { -#endif -#include "cmsis_os2.h" -#include "sl_board_configuration.h" -#include "sl_net.h" -#include "sl_si91x_driver.h" -#include "sl_si91x_host_interface.h" -#include "sl_si91x_types.h" -#include "sl_wifi.h" -#include "sl_wifi_callback_framework.h" -#include "sl_wifi_constants.h" -#include "sl_wifi_types.h" -#ifdef __cplusplus -} -#endif -/* LwIP includes. */ -#include "ethernetif.h" -#include "lwip/ethip6.h" -#include "lwip/timeouts.h" -#include "netif/etharp.h" -#include - -StaticSemaphore_t xEthernetIfSemaBuffer; - -/***************************************************************************** - * Defines - ******************************************************************************/ -#define STATION_NETIF0 's' -#define STATION_NETIF1 't' - -#define LWIP_FRAME_ALIGNMENT 60 - -uint32_t gOverrunCount = 0; - -/***************************************************************************** - * Variables - ******************************************************************************/ - -/***************************************************************************** - * @fn static void low_level_init(struct netif *netif) - * @brief - * Initializes the hardware parameters. Called from ethernetif_init(). - * - * @param[in] netif: the already initialized lwip network interface structure - * - * @return - * None - ******************************************************************************/ -static void low_level_init(struct netif * netif) -{ - /* set netif MAC hardware address length */ - netif->hwaddr_len = ETH_HWADDR_LEN; - - /* Set netif MAC hardware address */ - sl_wfx_mac_address_t mac_addr; - - wfx_get_wifi_mac_addr(SL_WFX_STA_INTERFACE, &mac_addr); - - netif->hwaddr[0] = mac_addr.octet[0]; - netif->hwaddr[1] = mac_addr.octet[1]; - netif->hwaddr[2] = mac_addr.octet[2]; - netif->hwaddr[3] = mac_addr.octet[3]; - netif->hwaddr[4] = mac_addr.octet[4]; - netif->hwaddr[5] = mac_addr.octet[5]; - - /* Set netif maximum transfer unit */ - netif->mtu = 1500; - - /* Accept broadcast address and ARP traffic */ - netif->flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP; - -#if LWIP_IPV6_MLD - netif->flags |= NETIF_FLAG_MLD6; -#endif /* LWIP_IPV6_MLD */ -} - -/******************************************************************************** - * @fn static void low_level_input(struct netif *netif, uint8_t *b, uint16_t len) - * @brief - * Make PBUF out of a linear buffer - that can be fed into lwip - * @param[in] netif: the already initialized lwip network interface structure - * @param[in] len: length - * @return - * None - ************************************************************************************/ -static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len) -{ - struct pbuf *p, *q; - uint32_t bufferoffset; - - if (len <= 0) - { - return; - } - if (len < LWIP_FRAME_ALIGNMENT) - { /* 60 : LWIP frame alignment */ - len = LWIP_FRAME_ALIGNMENT; - } - - /* Drop packets originated from the same interface and is not destined for the said interface */ - const uint8_t * src_mac = b + netif->hwaddr_len; - const uint8_t * dst_mac = b; - - if (!(ip6_addr_ispreferred(netif_ip6_addr_state(netif, 0))) && (memcmp(netif->hwaddr, src_mac, netif->hwaddr_len) == 0) && - (memcmp(netif->hwaddr, dst_mac, netif->hwaddr_len) != 0)) - { -#ifdef WIFI_DEBUG_ENABLED - ChipLogDetail(DeviceLayer, "DROP: [%02x:%02x:%02x:%02x:%02x:%02x]->[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", - - src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], - - dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5], - - b[12], b[13]); -#endif - return; - } - - /* We allocate a pbuf chain of pbufs from the Lwip buffer pool - * and copy the data to the pbuf chain - */ - if ((p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL)) != STRUCT_PBUF) - { - for (q = p, bufferoffset = 0; q != NULL; q = q->next) - { - memcpy((uint8_t *) q->payload, (uint8_t *) b + bufferoffset, q->len); - bufferoffset += q->len; - } -#ifdef WIFI_DEBUG_ENABLED - ChipLogDetail(DeviceLayer, "ACCEPT(%d): [%02x:%02x:%02x:%02x:%02x:%02x]->[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", - bufferoffset, - - src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5], - - dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5], - - b[12], b[13]); -#endif - - if (netif->input(p, netif) != ERR_OK) - { - gOverrunCount++; - pbuf_free(p); - } - } - else - { - gOverrunCount++; - } -} - -static SemaphoreHandle_t ethout_sem; -/***************************************************************************** - * @fn static err_t low_level_output(struct netif *netif, struct pbuf *p) - * @brief - * This function is called from LWIP task when LWIP stack - * has some data to be forwarded over WiFi Network - * - * @param[in] netif: lwip network interface - * - * @param[in] p: the packet to send - * - * @return - * ERR_OK if successful - ******************************************************************************/ -static err_t low_level_output(struct netif * netif, struct pbuf * p) -{ - UNUSED_PARAMETER(netif); - sl_status_t status; - status = sl_wifi_send_raw_data_frame(SL_WIFI_CLIENT_INTERFACE, (uint8_t *) p->payload, p->len); - if (status != SL_STATUS_OK) - { - return ERR_IF; - } - return ERR_OK; -} - -/***************************************************************************** - * @fn void sl_si91x_host_process_data_frame(uint8_t *buf, int len) - * @brief - * host received frame cb - * - * @param[in] buf: buffer - * - * @param[in] len: length - * - * @return - * None - ******************************************************************************/ -sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface, sl_wifi_buffer_t * buffer) -{ - struct pbuf * pbuf_packet; - void * packet; - struct netif * ifp; - sl_si91x_packet_t * rsi_pkt; - packet = sl_si91x_host_get_buffer_data(buffer, 0, NULL); - rsi_pkt = (sl_si91x_packet_t *) packet; - - /* get the network interface for STATION interface, - * and forward the received frame buffer to LWIP - */ - if ((ifp = wfx_get_netif(SL_WFX_STA_INTERFACE)) != (struct netif *) 0) - { - low_level_input(ifp, rsi_pkt->data, rsi_pkt->length); - } - return SL_STATUS_OK; -} - -/***************************************************************************** - * @fn err_t sta_ethernetif_init(struct netif *netif) - * @brief - * sta ethernet if initialization - * - * @param[in] netif: the lwip network interface structure - * - * @return - * ERR_OK if successful - ******************************************************************************/ -err_t sta_ethernetif_init(struct netif * netif) -{ - LWIP_ASSERT("netif != NULL", (netif != NULL)); - - /* Set the netif name to identify the interface */ - netif->name[0] = STATION_NETIF0; - netif->name[1] = STATION_NETIF1; - -#if LWIP_IPV4 && LWIP_ARP - netif->output = etharp_output; -#endif /* #if LWIP_IPV4 && LWIP_ARP */ -#if LWIP_IPV6 && LWIP_ETHERNET - netif->output_ip6 = ethip6_output; -#endif /* LWIP_IPV6 && LWIP_ETHERNET */ - netif->linkoutput = low_level_output; - - /* initialize the hardware */ - low_level_init(netif); - - /* Need single output only */ - ethout_sem = xSemaphoreCreateBinaryStatic(&xEthernetIfSemaBuffer); - xSemaphoreGive(ethout_sem); - - return ERR_OK; -} diff --git a/src/platform/silabs/SiWx917/wifi/ethernetif.h b/src/platform/silabs/SiWx917/wifi/ethernetif.h deleted file mode 100644 index bac51b9258..0000000000 --- a/src/platform/silabs/SiWx917/wifi/ethernetif.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "lwip/err.h" -#include "lwip/netif.h" -#ifdef __cplusplus -extern "C" { -#endif -/*************************************************************************** - * @fn err_t sta_ethernetif_init(struct netif *netif) - * @brief - * Sets up the station network interface. - * - * @param netif the lwip network interface structure - * @returns ERR_OK if successful - ******************************************************************************/ -err_t sta_ethernetif_init(struct netif * netif); - -/*************************************************************************** - * @fn err_t ap_ethernetif_init(struct netif *netif - * @brief - * Sets up the AP network interface. - * - * @param netif the lwip network interface structure - * @returns ERR_OK if successful - ******************************************************************************/ -err_t ap_ethernetif_init(struct netif * netif); - -void wfx_host_received_sta_frame_cb(uint8_t * buf, int len); - -#ifdef __cplusplus -} -#endif diff --git a/src/platform/silabs/SiWx917/wifi/wifi_config.h b/src/platform/silabs/SiWx917/wifi/wifi_config.h deleted file mode 100644 index f2f3b7ffeb..0000000000 --- a/src/platform/silabs/SiWx917/wifi/wifi_config.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef DEMO_CONFIG_H -#define DEMO_CONFIG_H - -#define USE_DHCP_CLIENT_DEFAULT (1) ///< If defined, DHCP is enabled, otherwise static address below is used - -/************************** Station Static Default ****************************/ -#define STA_IP_ADDR0_DEFAULT ((uint8_t) 192) ///< Static IP: IP address value 0 -#define STA_IP_ADDR1_DEFAULT ((uint8_t) 168) ///< Static IP: IP address value 1 -#define STA_IP_ADDR2_DEFAULT ((uint8_t) 0) ///< Static IP: IP address value 2 -#define STA_IP_ADDR3_DEFAULT ((uint8_t) 1) ///< Static IP: IP address value 3 - -/*NETMASK*/ -#define STA_NETMASK_ADDR0_DEFAULT ((uint8_t) 255) ///< Static IP: Netmask value 0 -#define STA_NETMASK_ADDR1_DEFAULT ((uint8_t) 255) ///< Static IP: Netmask value 1 -#define STA_NETMASK_ADDR2_DEFAULT ((uint8_t) 255) ///< Static IP: Netmask value 2 -#define STA_NETMASK_ADDR3_DEFAULT ((uint8_t) 0) ///< Static IP: Netmask value 3 - -/*Gateway Address*/ -#define STA_GW_ADDR0_DEFAULT ((uint8_t) 0) ///< Static IP: Gateway value 0 -#define STA_GW_ADDR1_DEFAULT ((uint8_t) 0) ///< Static IP: Gateway value 1 -#define STA_GW_ADDR2_DEFAULT ((uint8_t) 0) ///< Static IP: Gateway value 2 -#define STA_GW_ADDR3_DEFAULT ((uint8_t) 0) ///< Static IP: Gateway value 3 - -/************************** Access Point Static Default ****************************/ -// #define AP_IP_ADDR0_DEFAULT (uint8_t) 10 ///< Static IP: IP address value 0 -// #define AP_IP_ADDR1_DEFAULT (uint8_t) 10 ///< Static IP: IP address value 1 -// #define AP_IP_ADDR2_DEFAULT (uint8_t) 0 ///< Static IP: IP address value 2 -// #define AP_IP_ADDR3_DEFAULT (uint8_t) 1 ///< Static IP: IP address value 3 - -/*NETMASK*/ -// #define AP_NETMASK_ADDR0_DEFAULT (uint8_t) 255 ///< Static IP: Netmask value 0 -// #define AP_NETMASK_ADDR1_DEFAULT (uint8_t) 255 ///< Static IP: Netmask value 1 -// #define AP_NETMASK_ADDR2_DEFAULT (uint8_t) 255 ///< Static IP: Netmask value 2 -// #define AP_NETMASK_ADDR3_DEFAULT (uint8_t) 0 ///< Static IP: Netmask value 3 - -/*Gateway Address*/ -// #define AP_GW_ADDR0_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 0 -// #define AP_GW_ADDR1_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 1 -// #define AP_GW_ADDR2_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 2 -// #define AP_GW_ADDR3_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 3 - -#define WLAN_SSID_DEFAULT "AP_name" ///< wifi ssid for client mode -#define WLAN_PASSKEY_DEFAULT "passkey" ///< wifi password for client mode -#define WLAN_SECURITY_DEFAULT WFM_SECURITY_MODE_WPA2_PSK ///< wifi security mode for client mode: -///< WFM_SECURITY_MODE_OPEN/WFM_SECURITY_MODE_WEP/WFM_SECURITY_MODE_WPA2_WPA1_PSK - -#define SOFTAP_SSID_DEFAULT "silabs_softap" ///< wifi ssid for soft ap mode -#define SOFTAP_PASSKEY_DEFAULT "changeme" ///< wifi password for soft ap mode -#define SOFTAP_SECURITY_DEFAULT WFM_SECURITY_MODE_WPA2_PSK ///< wifi security for soft ap mode: -///< WFM_SECURITY_MODE_OPEN/WFM_SECURITY_MODE_WEP/WFM_SECURITY_MODE_WPA2_WPA1_PSK - -#define SOFTAP_CHANNEL_DEFAULT (6) ///< wifi channel for soft ap - -#endif // DEMO_CONFIG_H diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h index cef9ca323f..c30d4d653d 100644 --- a/src/platform/silabs/SilabsConfig.h +++ b/src/platform/silabs/SilabsConfig.h @@ -120,42 +120,46 @@ class SilabsConfig static constexpr Key kConfigKey_hostname = SilabsConfigKey(kMatterFactory_KeyBase, 0x15); static constexpr Key kConfigKey_clientid = SilabsConfigKey(kMatterFactory_KeyBase, 0x16); static constexpr Key kConfigKey_Test_Event_Trigger_Key = SilabsConfigKey(kMatterFactory_KeyBase, 0x17); - static constexpr Key kConfigKey_UniqueId = SilabsConfigKey(kMatterFactory_KeyBase, 0x1F); - static constexpr Key kConfigKey_Creds_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x20); - static constexpr Key kConfigKey_Creds_Base_Addr = SilabsConfigKey(kMatterFactory_KeyBase, 0x21); - static constexpr Key kConfigKey_Creds_DAC_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x22); - static constexpr Key kConfigKey_Creds_DAC_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x23); - static constexpr Key kConfigKey_Creds_PAI_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x24); - static constexpr Key kConfigKey_Creds_PAI_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x25); - static constexpr Key kConfigKey_Creds_CD_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x26); - static constexpr Key kConfigKey_Creds_CD_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x27); - static constexpr Key kConfigKey_Provision_Request = SilabsConfigKey(kMatterFactory_KeyBase, 0x28); - static constexpr Key kConfigKey_Provision_Version = SilabsConfigKey(kMatterFactory_KeyBase, 0x29); - - static constexpr Key kOtaTlvEncryption_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x30); + // kConfigKey_PersistentUniqueId is the inputkey in the generating of the Rotating Device ID + // SHALL NOT be the same as the UniqueID attribute exposed in the Basic Information cluster. + static constexpr Key kConfigKey_PersistentUniqueId = SilabsConfigKey(kMatterFactory_KeyBase, 0x1F); + static constexpr Key kConfigKey_Creds_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x20); + static constexpr Key kConfigKey_Creds_Base_Addr = SilabsConfigKey(kMatterFactory_KeyBase, 0x21); + static constexpr Key kConfigKey_Creds_DAC_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x22); + static constexpr Key kConfigKey_Creds_DAC_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x23); + static constexpr Key kConfigKey_Creds_PAI_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x24); + static constexpr Key kConfigKey_Creds_PAI_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x25); + static constexpr Key kConfigKey_Creds_CD_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x26); + static constexpr Key kConfigKey_Creds_CD_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x27); + static constexpr Key kConfigKey_Provision_Request = SilabsConfigKey(kMatterFactory_KeyBase, 0x28); + static constexpr Key kConfigKey_Provision_Version = SilabsConfigKey(kMatterFactory_KeyBase, 0x29); + static constexpr Key kOtaTlvEncryption_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x30); // Matter Config Keys - static constexpr Key kConfigKey_ServiceConfig = SilabsConfigKey(kMatterConfig_KeyBase, 0x01); - static constexpr Key kConfigKey_PairedAccountId = SilabsConfigKey(kMatterConfig_KeyBase, 0x02); - static constexpr Key kConfigKey_ServiceId = SilabsConfigKey(kMatterConfig_KeyBase, 0x03); - static constexpr Key kConfigKey_LastUsedEpochKeyId = SilabsConfigKey(kMatterConfig_KeyBase, 0x05); - static constexpr Key kConfigKey_FailSafeArmed = SilabsConfigKey(kMatterConfig_KeyBase, 0x06); - static constexpr Key kConfigKey_GroupKey = SilabsConfigKey(kMatterConfig_KeyBase, 0x07); - static constexpr Key kConfigKey_HardwareVersion = SilabsConfigKey(kMatterConfig_KeyBase, 0x08); - static constexpr Key kConfigKey_RegulatoryLocation = SilabsConfigKey(kMatterConfig_KeyBase, 0x09); - static constexpr Key kConfigKey_CountryCode = SilabsConfigKey(kMatterConfig_KeyBase, 0x0A); - static constexpr Key kConfigKey_WiFiSSID = SilabsConfigKey(kMatterConfig_KeyBase, 0x0C); - static constexpr Key kConfigKey_WiFiPSK = SilabsConfigKey(kMatterConfig_KeyBase, 0x0D); - static constexpr Key kConfigKey_WiFiSEC = SilabsConfigKey(kMatterConfig_KeyBase, 0x0E); - static constexpr Key kConfigKey_GroupKeyBase = SilabsConfigKey(kMatterConfig_KeyBase, 0x0F); - static constexpr Key kConfigKey_LockUser = SilabsConfigKey(kMatterConfig_KeyBase, 0x10); - static constexpr Key kConfigKey_Credential = SilabsConfigKey(kMatterConfig_KeyBase, 0x11); - static constexpr Key kConfigKey_LockUserName = SilabsConfigKey(kMatterConfig_KeyBase, 0x12); - static constexpr Key kConfigKey_CredentialData = SilabsConfigKey(kMatterConfig_KeyBase, 0x13); - static constexpr Key kConfigKey_UserCredentials = SilabsConfigKey(kMatterConfig_KeyBase, 0x14); - static constexpr Key kConfigKey_WeekDaySchedules = SilabsConfigKey(kMatterConfig_KeyBase, 0x15); - static constexpr Key kConfigKey_YearDaySchedules = SilabsConfigKey(kMatterConfig_KeyBase, 0x16); - static constexpr Key kConfigKey_HolidaySchedules = SilabsConfigKey(kMatterConfig_KeyBase, 0x17); + static constexpr Key kConfigKey_ServiceConfig = SilabsConfigKey(kMatterConfig_KeyBase, 0x01); + static constexpr Key kConfigKey_PairedAccountId = SilabsConfigKey(kMatterConfig_KeyBase, 0x02); + static constexpr Key kConfigKey_ServiceId = SilabsConfigKey(kMatterConfig_KeyBase, 0x03); + static constexpr Key kConfigKey_LastUsedEpochKeyId = SilabsConfigKey(kMatterConfig_KeyBase, 0x05); + static constexpr Key kConfigKey_FailSafeArmed = SilabsConfigKey(kMatterConfig_KeyBase, 0x06); + static constexpr Key kConfigKey_GroupKey = SilabsConfigKey(kMatterConfig_KeyBase, 0x07); + static constexpr Key kConfigKey_HardwareVersion = SilabsConfigKey(kMatterConfig_KeyBase, 0x08); + static constexpr Key kConfigKey_RegulatoryLocation = SilabsConfigKey(kMatterConfig_KeyBase, 0x09); + static constexpr Key kConfigKey_CountryCode = SilabsConfigKey(kMatterConfig_KeyBase, 0x0A); + static constexpr Key kConfigKey_WiFiSSID = SilabsConfigKey(kMatterConfig_KeyBase, 0x0C); + static constexpr Key kConfigKey_WiFiPSK = SilabsConfigKey(kMatterConfig_KeyBase, 0x0D); + static constexpr Key kConfigKey_WiFiSEC = SilabsConfigKey(kMatterConfig_KeyBase, 0x0E); + static constexpr Key kConfigKey_GroupKeyBase = SilabsConfigKey(kMatterConfig_KeyBase, 0x0F); + static constexpr Key kConfigKey_LockUser = SilabsConfigKey(kMatterConfig_KeyBase, 0x10); + static constexpr Key kConfigKey_Credential = SilabsConfigKey(kMatterConfig_KeyBase, 0x11); + static constexpr Key kConfigKey_LockUserName = SilabsConfigKey(kMatterConfig_KeyBase, 0x12); + static constexpr Key kConfigKey_CredentialData = SilabsConfigKey(kMatterConfig_KeyBase, 0x13); + static constexpr Key kConfigKey_UserCredentials = SilabsConfigKey(kMatterConfig_KeyBase, 0x14); + static constexpr Key kConfigKey_WeekDaySchedules = SilabsConfigKey(kMatterConfig_KeyBase, 0x15); + static constexpr Key kConfigKey_YearDaySchedules = SilabsConfigKey(kMatterConfig_KeyBase, 0x16); + static constexpr Key kConfigKey_HolidaySchedules = SilabsConfigKey(kMatterConfig_KeyBase, 0x17); + // UniqueId exposed in the Basic Information cluster. It is cleared on factoryreset + // We will generate a random ID, if none was previously provided. + static constexpr Key kConfigKey_UniqueId = SilabsConfigKey(kMatterConfig_KeyBase, 0x18); static constexpr Key kConfigKey_OpKeyMap = SilabsConfigKey(kMatterConfig_KeyBase, 0x20); static constexpr Key kConfigKey_BootCount = SilabsConfigKey(kMatterConfig_KeyBase, 0x21); static constexpr Key kConfigKey_TotalOperationalHours = SilabsConfigKey(kMatterConfig_KeyBase, 0x22); diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index ef553bffa1..44956572a6 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -343,7 +343,7 @@ CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const C void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) { - // Nothing to do + CloseConnection(conId); } CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) @@ -674,6 +674,21 @@ void BLEManagerImpl::HandleConnectEvent(volatile sl_bt_msg_t * evt) PlatformMgr().ScheduleWork(DriveBLEState, 0); } +void BLEManagerImpl::HandleConnectParams(volatile sl_bt_msg_t * evt) +{ + sl_bt_evt_connection_parameters_t * con_param_evt = (sl_bt_evt_connection_parameters_t *) &(evt->data); + + if (con_param_evt->timeout < BLE_CONFIG_TIMEOUT) + { + ChipLogProgress(DeviceLayer, "Request to increase the connection timeout from %d to %d", con_param_evt->timeout, + BLE_CONFIG_TIMEOUT); + sl_bt_connection_set_parameters(con_param_evt->connection, BLE_CONFIG_MIN_INTERVAL, BLE_CONFIG_MAX_INTERVAL, + BLE_CONFIG_LATENCY, BLE_CONFIG_TIMEOUT, BLE_CONFIG_MIN_CE_LENGTH, BLE_CONFIG_MAX_CE_LENGTH); + } + + PlatformMgr().ScheduleWork(DriveBLEState, 0); +} + void BLEManagerImpl::HandleConnectionCloseEvent(volatile sl_bt_msg_t * evt) { sl_bt_evt_connection_closed_t * conn_evt = (sl_bt_evt_connection_closed_t *) &(evt->data); @@ -1061,11 +1076,20 @@ extern "C" void sl_bt_on_event(sl_bt_msg_t * evt) } break; case sl_bt_evt_connection_parameters_id: { - // ChipLogProgress(DeviceLayer, "Connection parameter ID received"); + ChipLogProgress(DeviceLayer, "Connection parameter ID received - i:%d, l:%d, t:%d, sm:%d", + evt->data.evt_connection_parameters.interval, evt->data.evt_connection_parameters.latency, + evt->data.evt_connection_parameters.timeout, evt->data.evt_connection_parameters.security_mode); + chip::DeviceLayer::Internal::BLEMgrImpl().HandleConnectParams(evt); } break; case sl_bt_evt_connection_phy_status_id: { - // ChipLogProgress(DeviceLayer, "PHY update procedure is completed"); + ChipLogProgress(DeviceLayer, "Connection phy status ID received - phy:%d", evt->data.evt_connection_phy_status.phy); + } + break; + case sl_bt_evt_connection_data_length_id: { + ChipLogProgress(DeviceLayer, "Connection data length ID received - txL:%d, txT:%d, rxL:%d, rxL:%d", + evt->data.evt_connection_data_length.tx_data_len, evt->data.evt_connection_data_length.tx_time_us, + evt->data.evt_connection_data_length.rx_data_len, evt->data.evt_connection_data_length.rx_time_us); } break; case sl_bt_evt_connection_closed_id: { diff --git a/src/platform/silabs/efr32/BUILD.gn b/src/platform/silabs/efr32/BUILD.gn index 4bc881f5f5..f39628d484 100644 --- a/src/platform/silabs/efr32/BUILD.gn +++ b/src/platform/silabs/efr32/BUILD.gn @@ -20,8 +20,6 @@ import("${chip_root}/src/platform/device.gni") import("${chip_root}/third_party/silabs/efr32_sdk.gni") import("${chip_root}/third_party/silabs/silabs_board.gni") -silabs_platform_dir = "${chip_root}/src/platform/silabs" - assert(chip_device_platform == "efr32") if (chip_enable_openthread) { @@ -32,9 +30,12 @@ if (chip_crypto == "platform") { import("//build_overrides/mbedtls.gni") } -config("efr32-platform-wifi-config") { - include_dirs = [ "wifi" ] - defines = [] +source_set("logging") { + sources = [ "${chip_root}/src/platform/silabs/Logging.cpp" ] + deps = [ + "${chip_root}/src/platform:platform_base", + "${chip_root}/src/platform/logging:headers", + ] } static_library("efr32") { @@ -159,28 +160,8 @@ static_library("efr32") { "${silabs_platform_dir}/ConnectivityManagerImpl_WIFI.cpp", "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.cpp", "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.h", - "${silabs_platform_dir}/wifi/wfx_host_events.h", - "wifi/wfx_msgs.h", - "wifi/wifi_config.h", ] - if (use_wf200 || use_rs9116 || use_SiWx917) { - sources += [ - "${silabs_platform_dir}/wifi/dhcp_client.cpp", - "wifi/ethernetif.cpp", - "wifi/ethernetif.h", - "wifi/lwip_netif.cpp", - ] - } - - public_configs += [ ":efr32-platform-wifi-config" ] + public_deps += [ "${silabs_platform_dir}/wifi:wifi-platform" ] } } - -source_set("logging") { - sources = [ "${chip_root}/src/platform/silabs/Logging.cpp" ] - deps = [ - "${chip_root}/src/platform:platform_base", - "${chip_root}/src/platform/logging:headers", - ] -} diff --git a/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp b/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp index 8028d84d92..a1811a1093 100644 --- a/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp +++ b/src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp @@ -1406,7 +1406,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointCofactorMul(void * R) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1in, size_t w1in_len) +CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_len, const uint8_t * w1sin, size_t w1sin_len) { CHIP_ERROR error = CHIP_NO_ERROR; int result = 0; @@ -1418,7 +1418,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::ComputeL(uint8_t * Lout, size_t * L_le mbedtls_mpi_init(&w1_bn); mbedtls_ecp_point_init(&Ltemp); - result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1in), w1in_len); + result = mbedtls_mpi_read_binary(&w1_bn, Uint8::to_const_uchar(w1sin), w1sin_len); VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL); result = mbedtls_mpi_mod_mpi(&w1_bn, &w1_bn, &context->curve.N); diff --git a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp index 4fc7f8d742..a884071560 100644 --- a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp @@ -19,17 +19,17 @@ #include #include #include +#include + +#if SL_WIFI +#include +#endif // SL_WIFI extern "C" { #include "btl_interface.h" #include "sl_core.h" -#if SL_WIFI -#include "spi_multiplex.h" -#endif // SL_WIFI } -#include - /// No error, operation OK #define SL_BOOTLOADER_OK 0L diff --git a/src/platform/silabs/efr32/args.gni b/src/platform/silabs/efr32/args.gni index 394e4bb1bd..501661866a 100644 --- a/src/platform/silabs/efr32/args.gni +++ b/src/platform/silabs/efr32/args.gni @@ -20,9 +20,9 @@ import("${chip_root}/examples/platform/silabs/args.gni") import("${chip_root}/src/crypto/crypto.gni") # ARM architecture flags will be set based on silabs_family. -arm_platform_config = "${efr32_sdk_build_root}/silabs_arm.gni" +arm_platform_config = "${silabs_sdk_build_root}/silabs_arm.gni" -mbedtls_target = "${efr32_sdk_build_root}:efr32_sdk" +mbedtls_target = "${silabs_sdk_build_root}:silabs_sdk" openthread_external_mbedtls = mbedtls_target diff --git a/src/platform/silabs/efr32/wifi/lwip_netif.cpp b/src/platform/silabs/efr32/wifi/lwip_netif.cpp deleted file mode 100644 index 3a0d104a90..0000000000 --- a/src/platform/silabs/efr32/wifi/lwip_netif.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include "em_bus.h" -#include "em_cmu.h" -#include "em_gpio.h" -#include "em_ldma.h" -#include "em_usart.h" - -#include "wfx_host_events.h" -#include "wifi_config.h" - -#include "dhcp_client.h" -#include "ethernetif.h" - -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" - -#include -#include -using namespace ::chip; -using namespace ::chip::DeviceLayer; -static struct netif sta_netif; - -#ifdef SL_WFX_CONFIG_SOFTAP -static struct netif ap_netif; -#endif - -/**************************************************************************** - * @fn static void netif_config(struct netif *sta_if, struct netif *ap_if) - * @brief - * netif configuration - * @param[in] sta_if: - * @param[in] ap_if: - * @return None - *****************************************************************************/ -static void netif_config(struct netif * sta_if, struct netif * ap_if) -{ - if (sta_if != NULL) - { -#if LWIP_IPV4 - ip_addr_t sta_ipaddr; - ip_addr_t sta_netmask; - ip_addr_t sta_gw; - - /* Initialize the Station information */ - ip_addr_set_zero_ip4(&sta_ipaddr); - ip_addr_set_zero_ip4(&sta_netmask); - ip_addr_set_zero_ip4(&sta_gw); -#endif /* LWIP_IPV4 */ - - /* Add station interfaces */ - netif_add(sta_if, -#if LWIP_IPV4 - (const ip4_addr_t *) &sta_ipaddr, (const ip4_addr_t *) &sta_netmask, (const ip4_addr_t *) &sta_gw, -#endif /* LWIP_IPV4 */ - NULL, &sta_ethernetif_init, &tcpip_input); - - /* Registers the default network interface */ - netif_set_default(sta_if); - } -} - -/**************************************************************************** - * @fn void wfx_lwip_set_sta_link_up(void) - * @brief - * Set station link status to up. - * @param[in] None - * @return None - *****************************************************************************/ -void wfx_lwip_set_sta_link_up(void) -{ - netifapi_netif_set_up(&sta_netif); - netifapi_netif_set_link_up(&sta_netif); -#if LWIP_IPV4 && LWIP_DHCP - dhcpclient_set_link_state(LINK_UP); -#endif /* LWIP_IPV4 && LWIP_DHCP */ - /* - * Enable IPV6 - */ - -#if LWIP_IPV6_AUTOCONFIG - sta_netif.ip6_autoconfig_enabled = 1; -#endif /* LWIP_IPV6_AUTOCONFIG */ - netif_create_ip6_linklocal_address(&sta_netif, MAC_48_BIT_SET); -} - -/*************************************************************************** - * @fn void wfx_lwip_set_sta_link_down(void) - * @brief - * Set station link status to down. - * @param[in] None - * @return None - *****************************************************************************/ -void wfx_lwip_set_sta_link_down(void) -{ -#if LWIP_IPV4 && LWIP_DHCP - dhcpclient_set_link_state(LINK_DOWN); -#endif /* LWIP_IPV4 && LWIP_DHCP */ - netifapi_netif_set_link_down(&sta_netif); - netifapi_netif_set_down(&sta_netif); -} - -/*************************************************************************** - * @fn void wfx_lwip_start(void) - * @brief - * Initialize the LwIP stack - * @param[in] None - * @return None - *****************************************************************************/ -void wfx_lwip_start(void) -{ - /* Initialize the LwIP stack */ - netif_config(&sta_netif, NULL); -} - -/*************************************************************************** - * @fn struct netif *wfx_get_netif(sl_wfx_interface_t interface) - * @brief - * get the netif - * @param[in] interface: - * @return None - *****************************************************************************/ -struct netif * wfx_get_netif(sl_wfx_interface_t interface) -{ - if (interface == SL_WFX_STA_INTERFACE) - { - return &sta_netif; - } -#ifdef SL_WFX_CONFIG_SOFTAP - else if (interface == SL_WFX_SOFTAP_INTERFACE) - { - return &ap_netif; - } -#endif - return (struct netif *) 0; -} diff --git a/src/platform/silabs/efr32/wifi/wfx_msgs.h b/src/platform/silabs/efr32/wifi/wfx_msgs.h deleted file mode 100644 index edf0aec582..0000000000 --- a/src/platform/silabs/efr32/wifi/wfx_msgs.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _WFX_MSGS_H_ -#define _WFX_MSGS_H_ -/* - * Taken from sl_wfx firmware - so I can re-use. - * I need to do a better job than to use this stuff - * in the CPP files of Matter - */ -typedef struct -{ - uint8_t octet[6]; ///< Table to store a MAC address -} sl_wfx_mac_address_t; -/** - * @brief General Message header structure - * - */ -typedef struct __attribute__((__packed__)) sl_wfx_header_s -{ - uint16_t length; ///< Message length in bytes including this uint16_t. - ///< Maximum value is 8188 but maximum Request size is FW dependent and reported in the - ///< ::sl_wfx_startup_ind_body_t::size_inp_ch_buf. - uint8_t id; ///< Contains the message Id indexed by sl_wfx_general_commands_ids_t or sl_wfx_message_ids_t. - uint8_t info; ///< TODO comment missing -} sl_wfx_header_t; - -/** - * @brief Generic message structure for all requests, confirmations and indications - * - */ -typedef struct __attribute__((__packed__)) sl_wfx_generic_message_s -{ - sl_wfx_header_t header; ///< 4 bytes header - uint8_t body[]; ///< variable size payload of the message -} sl_wfx_generic_message_t; -#define SL_WFX_OPN_SIZE 14 -#define SL_WFX_UID_SIZE 8 -#define SL_WFX_DISABLED_CHANNEL_LIST_SIZE 2 -#define SL_WFX_FIRMWARE_LABEL_SIZE 128 -/** - * @brief Startup Indication message. - * This is the first message sent to the host to confirm boot success. - * It gives detailed information on the HW and FW versions and capabilities - */ -typedef struct __attribute__((__packed__)) sl_wfx_startup_ind_body_s -{ - uint32_t - status; ///< Initialization status. A value of zero indicates the boot is completed successfully (see enum sl_wfx_status_t) - uint16_t hardware_id; ///<=RO misc_read_reg7 register value -#if 0 /* Not used in RS911x for now - use stuff here for the port */ - uint8_t opn[SL_WFX_OPN_SIZE]; ///<=OTP part_OPN - uint8_t uid[SL_WFX_UID_SIZE]; ///<=OTP UID - uint16_t num_inp_ch_bufs; ///WFM_STATUS_SUCCESS: the connection request was completed successfully. - *
any other value: the connection request failed. - *
See sl_wfx_fmac_status_t for enumeration values. - */ - uint32_t status; - /** - * @brief MAC address of the connected access point. - */ - uint8_t mac[6]; - /** - * @brief Channel of the connected access point. - * @details 1 - 13: Channel number. - */ - uint16_t channel; - /** - * @brief Beacon Interval of the connected access point. - */ - uint8_t beacon_interval; - /** - * @brief DTIM period of the connected access point. - * @details 1 - 255: DTIM period. - */ - uint8_t dtim_period; - /** - * @brief Maximum PHY data rate supported by the connection. - * @details See sl_wfx_rate_index_t for enumeration values. - */ - uint16_t max_phy_rate; -} sl_wfx_connect_ind_body_t; - -/** - * @brief Indication message used to signal the completion of a connection operation. - * @details The device will send this indication to signal the connection request initiated - * with sl_wfx_connect_req_t has been completed. The indication is also sent when - * the device autonomously roams to another access point. - * @ingroup WFM_GROUP_MODE_IDLE - */ -typedef struct __attribute__((__packed__)) sl_wfx_connect_ind_s -{ - /** Common message header. */ - sl_wfx_header_t header; - /** Indication message body. */ - sl_wfx_connect_ind_body_t body; -} sl_wfx_connect_ind_t; -/** - * @brief Indication message body for sl_wfx_disconnect_ind_t. - */ -typedef struct __attribute__((__packed__)) sl_wfx_disconnect_ind_body_s -{ - /** - * @brief MAC address of the access point. - */ - uint8_t mac[6]; - /** - * @brief Reason for disconnection. - * @details WFM_DISCONNECTED_REASON_UNSPECIFIED: The device disconnected because of an internal error. - *
WFM_DISCONNECTED_REASON_AP_LOST: The device lost the AP beacons for too long. - *
WFM_DISCONNECTED_REASON_REJECTED: The device was disconnected by the AP. - *
WFM_DISCONNECTED_REASON_LEAVING_BSS: Disconnection was requested through the device API. - *
WFM_DISCONNECTED_REASON_WPA_COUNTERMEASURES: WPA countermeasures triggered a disconnection - *
See sl_wfx_disconnected_reason_t for enumeration values. - */ - uint16_t reason; -} sl_wfx_disconnect_ind_body_t; - -/** - * @brief Indication message used to signal the completion of a disconnection operation. - * @details The device will send this indication to signal the disconnection request initiated - * with sl_wfx_disconnect_req_t has been completed. The indication is also sent when - * the device has lost the connection to an access point and has been unable to regain it. - * @ingroup WFM_GROUP_MODE_STA - */ -typedef struct __attribute__((__packed__)) sl_wfx_disconnect_ind_s -{ - /** Common message header. */ - sl_wfx_header_t header; - /** Indication message body. */ - sl_wfx_disconnect_ind_body_t body; -} sl_wfx_disconnect_ind_t; - -#endif /* _WFX_MSGS_H_ */ diff --git a/src/platform/silabs/efr32/wifi/wifi_config.h b/src/platform/silabs/efr32/wifi/wifi_config.h deleted file mode 100644 index 8e00201b7f..0000000000 --- a/src/platform/silabs/efr32/wifi/wifi_config.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef WIFI_CONFIG_H -#define WIFI_CONFIG_H - -#define USE_DHCP_CLIENT_DEFAULT 1 ///< If defined, DHCP is enabled, otherwise static address below is used - -/************************** Station Static Default ****************************/ -#define STA_IP_ADDR0_DEFAULT (uint8_t) 192 ///< Static IP: IP address value 0 -#define STA_IP_ADDR1_DEFAULT (uint8_t) 168 ///< Static IP: IP address value 1 -#define STA_IP_ADDR2_DEFAULT (uint8_t) 0 ///< Static IP: IP address value 2 -#define STA_IP_ADDR3_DEFAULT (uint8_t) 1 ///< Static IP: IP address value 3 - -/*NETMASK*/ -#define STA_NETMASK_ADDR0_DEFAULT (uint8_t) 255 ///< Static IP: Netmask value 0 -#define STA_NETMASK_ADDR1_DEFAULT (uint8_t) 255 ///< Static IP: Netmask value 1 -#define STA_NETMASK_ADDR2_DEFAULT (uint8_t) 255 ///< Static IP: Netmask value 2 -#define STA_NETMASK_ADDR3_DEFAULT (uint8_t) 0 ///< Static IP: Netmask value 3 - -/*Gateway Address*/ -#define STA_GW_ADDR0_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 0 -#define STA_GW_ADDR1_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 1 -#define STA_GW_ADDR2_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 2 -#define STA_GW_ADDR3_DEFAULT (uint8_t) 0 ///< Static IP: Gateway value 3 - -#define WLAN_SSID_DEFAULT "AP_name" ///< wifi ssid for client mode -#define WLAN_PASSKEY_DEFAULT "passkey" ///< wifi password for client mode -#define WLAN_SECURITY_DEFAULT WFM_SECURITY_MODE_WPA2_PSK ///< wifi security mode for client mode: -///< WFM_SECURITY_MODE_OPEN/WFM_SECURITY_MODE_WEP/WFM_SECURITY_MODE_WPA2_WPA1_PSK - -#define SOFTAP_SSID_DEFAULT "silabs_softap" ///< wifi ssid for soft ap mode -#define SOFTAP_PASSKEY_DEFAULT "changeme" ///< wifi password for soft ap mode -#define SOFTAP_SECURITY_DEFAULT WFM_SECURITY_MODE_WPA2_PSK ///< wifi security for soft ap mode: -///< WFM_SECURITY_MODE_OPEN/WFM_SECURITY_MODE_WEP/WFM_SECURITY_MODE_WPA2_WPA1_PSK - -#define SOFTAP_CHANNEL_DEFAULT 6 ///< wifi channel for soft ap - -#endif // WIFI_CONFIG_H diff --git a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp index 92ddd281f8..361dfa93a4 100644 --- a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp +++ b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp @@ -15,12 +15,17 @@ * limitations under the License. */ +#include +#include #include - #if defined(_SILICON_LABS_32B_SERIES_2) +#include "em_msc.h" #include "em_rmu.h" -#else +#elif defined(_SILICON_LABS_32B_SERIES_3) #include "sl_hal_emu.h" +#include "sl_se_manager.h" +#include "sl_se_manager_types.h" +#include #endif // _SILICON_LABS_32B_SERIES_2 #include "sl_system_kernel.h" @@ -65,6 +70,18 @@ extern "C" { #include "silabs_utils.h" #endif +#if defined(_SILICON_LABS_32B_SERIES_3) +// To remove any ambiguities regarding the Flash aliases, use the below macro to ignore the 8 MSB. +#define FLASH_GENERIC_MASK 0x00FFFFFF +#define GENERIC_ADDRESS(addr) ((addr) &FLASH_GENERIC_MASK) + +// Transforms any address into an address using the same alias as FLASH_BASE from the CMSIS. +#define CMSIS_CONVERTED_ADDRESS(addr) (GENERIC_ADDRESS(addr) | FLASH_BASE) +namespace { +sl_se_command_context_t cmd_ctx; +} +#endif // _SILICON_LABS_32B_SERIES_3 + namespace chip { namespace DeviceLayer { namespace Silabs { @@ -107,6 +124,56 @@ CHIP_ERROR SilabsPlatform::Init(void) return CHIP_NO_ERROR; } +CHIP_ERROR SilabsPlatform::FlashInit() +{ +#if defined(_SILICON_LABS_32B_SERIES_2) + MSC_Init(); +#elif defined(_SILICON_LABS_32B_SERIES_3) + sl_status_t status; + status = sl_se_init(); + VerifyOrReturnError(status == SL_STATUS_OK, CHIP_ERROR(status)); + status = sl_se_init_command_context(&cmd_ctx); + VerifyOrReturnError(status == SL_STATUS_OK, CHIP_ERROR(status)); +#endif + return CHIP_NO_ERROR; +} + +CHIP_ERROR SilabsPlatform::FlashErasePage(uint32_t addr) +{ +#if defined(_SILICON_LABS_32B_SERIES_2) + MSC_ErasePage((uint32_t *) addr); +#elif defined(_SILICON_LABS_32B_SERIES_3) + sl_status_t status; + uint32_t * data_start = NULL; + size_t data_size; + + status = sl_se_data_region_get_location(&cmd_ctx, (void **) &data_start, &data_size); + VerifyOrReturnError(status == SL_STATUS_OK, CHIP_ERROR(status)); + VerifyOrReturnError(GENERIC_ADDRESS(addr) > GENERIC_ADDRESS((uint32_t) data_start), CHIP_ERROR_INVALID_ADDRESS); + status = sl_se_data_region_erase(&cmd_ctx, (void *) addr, 1); // Erase one page + VerifyOrReturnError(status == SL_STATUS_OK, CHIP_ERROR(status)); +#endif + return CHIP_NO_ERROR; +} + +CHIP_ERROR SilabsPlatform::FlashWritePage(uint32_t addr, const uint8_t * data, size_t size) +{ +#if defined(_SILICON_LABS_32B_SERIES_2) + MSC_WriteWord((uint32_t *) addr, data, size); +#elif defined(_SILICON_LABS_32B_SERIES_3) + sl_status_t status; + uint32_t * data_start = NULL; + size_t data_size; + + status = sl_se_data_region_get_location(&cmd_ctx, (void **) &data_start, &data_size); + VerifyOrReturnError(status == SL_STATUS_OK, CHIP_ERROR(status)); + VerifyOrReturnError(GENERIC_ADDRESS(addr) > GENERIC_ADDRESS((uint32_t) data_start), CHIP_ERROR_INVALID_ADDRESS); + status = sl_se_data_region_write(&cmd_ctx, (void *) addr, data, size); + VerifyOrReturnError(status == SL_STATUS_OK, CHIP_ERROR(status)); +#endif + return CHIP_NO_ERROR; +} + #ifdef ENABLE_WSTK_LEDS void SilabsPlatform::InitLed(void) { @@ -151,8 +218,7 @@ void SilabsPlatform::StartScheduler() } #ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT -extern "C" { -void sl_button_on_change(const sl_button_t * handle) +extern "C" void sl_button_on_change(const sl_button_t * handle) { if (Silabs::GetPlatform().mButtonCallback == nullptr) { @@ -168,7 +234,6 @@ void sl_button_on_change(const sl_button_t * handle) } } } -} uint8_t SilabsPlatform::GetButtonState(uint8_t button) { diff --git a/src/platform/silabs/platformAbstraction/SilabsPlatform.h b/src/platform/silabs/platformAbstraction/SilabsPlatform.h index 49f5264cac..df84224c50 100644 --- a/src/platform/silabs/platformAbstraction/SilabsPlatform.h +++ b/src/platform/silabs/platformAbstraction/SilabsPlatform.h @@ -57,6 +57,10 @@ class SilabsPlatform : virtual public SilabsPlatformAbstractionBase void StartScheduler(void) override; + CHIP_ERROR FlashInit() override; + CHIP_ERROR FlashErasePage(uint32_t addr) override; + CHIP_ERROR FlashWritePage(uint32_t addr, const uint8_t * data, size_t size) override; + private: friend SilabsPlatform & GetPlatform(void); diff --git a/src/platform/silabs/platformAbstraction/SilabsPlatformBase.h b/src/platform/silabs/platformAbstraction/SilabsPlatformBase.h index 12f87c07ea..818463ecfb 100644 --- a/src/platform/silabs/platformAbstraction/SilabsPlatformBase.h +++ b/src/platform/silabs/platformAbstraction/SilabsPlatformBase.h @@ -51,6 +51,11 @@ class SilabsPlatformAbstractionBase virtual bool GetLedState(uint8_t led) { return 0; } virtual CHIP_ERROR ToggleLed(uint8_t led) { return CHIP_ERROR_NOT_IMPLEMENTED; } + // Flash + virtual CHIP_ERROR FlashInit() { return CHIP_ERROR_NOT_IMPLEMENTED; } + virtual CHIP_ERROR FlashErasePage(uint32_t addr) { return CHIP_ERROR_NOT_IMPLEMENTED; } + virtual CHIP_ERROR FlashWritePage(uint32_t addr, const uint8_t * data, size_t size) { return CHIP_ERROR_NOT_IMPLEMENTED; } + // BLE Specific Method protected: diff --git a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp index cf60cf5c58..1b03de76f3 100644 --- a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp +++ b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp @@ -17,11 +17,13 @@ #include #include +#include #include #include #include +#include #include #if SILABS_LOG_ENABLED @@ -150,8 +152,7 @@ void SilabsPlatform::StartScheduler() vTaskStartScheduler(); } -extern "C" { -void sl_button_on_change(uint8_t btn, uint8_t btnAction) +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction) { #if SL_ICD_ENABLED // This is to make sure we get a one-press and one-release event for the button @@ -159,21 +160,21 @@ void sl_button_on_change(uint8_t btn, uint8_t btnAction) // Currently the btn0 is pull-up resistor due to which is sends a release event on every wakeup if (btn == SL_BUTTON_BTN0_NUMBER) { - if (btnAction == BUTTON_PRESSED) + // if the btn was not pressed and only a release event came, ignore it + // if the btn was already pressed and another press event came, ignore it + // essentially, if both of them are in the same state then ignore it. + VerifyOrReturn(btnAction != btn0_pressed); + + if ((btnAction == BUTTON_PRESSED) && (btn0_pressed == false)) { btn0_pressed = true; } - else if ((btnAction == BUTTON_RELEASED) && (btn0_pressed == false)) - { - // if the btn was not pressed and only a release event came, ignore it - return; - } else if ((btnAction == BUTTON_RELEASED) && (btn0_pressed == true)) { btn0_pressed = false; } } -#endif /* SL_ICD_ENABLED */ +#endif // SL_ICD_ENABLED if (Silabs::GetPlatform().mButtonCallback == nullptr) { return; @@ -185,13 +186,29 @@ void sl_button_on_change(uint8_t btn, uint8_t btnAction) } Silabs::GetPlatform().mButtonCallback(btn, btnAction); } -} uint8_t SilabsPlatform::GetButtonState(uint8_t button) { return (button < SL_SI91x_BUTTON_COUNT) ? sButtonStates[button] : 0; } +CHIP_ERROR SilabsPlatform::FlashInit() +{ + return CHIP_NO_ERROR; +} + +CHIP_ERROR SilabsPlatform::FlashErasePage(uint32_t addr) +{ + rsi_flash_erase_sector((uint32_t *) addr); + return CHIP_NO_ERROR; +} + +CHIP_ERROR SilabsPlatform::FlashWritePage(uint32_t addr, const uint8_t * data, size_t size) +{ + rsi_flash_write((uint32_t *) addr, (unsigned char *) data, size); + return CHIP_NO_ERROR; +} + } // namespace Silabs } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/silabs/provision/BUILD.gn b/src/platform/silabs/provision/BUILD.gn index ea5d4b072a..7ae41c0515 100644 --- a/src/platform/silabs/provision/BUILD.gn +++ b/src/platform/silabs/provision/BUILD.gn @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") -import("${efr32_sdk_build_root}/silabs_board.gni") +import("${silabs_sdk_build_root}/silabs_board.gni") config("provision-config") { include_dirs = [ "." ] diff --git a/src/platform/silabs/provision/ProvisionStorage.h b/src/platform/silabs/provision/ProvisionStorage.h index ff012491ae..916d088fb6 100644 --- a/src/platform/silabs/provision/ProvisionStorage.h +++ b/src/platform/silabs/provision/ProvisionStorage.h @@ -62,18 +62,18 @@ enum ID : uint16_t kCertToolPath = 0x0137, kPylinkLib = 0x0138, // Instance Info, - kSerialNumber = 0x0141, - kVendorId = 0x0142, - kVendorName = 0x0143, - kProductId = 0x0144, - kProductName = 0x0145, - kProductLabel = 0x0146, - kProductUrl = 0x0147, - kPartNumber = 0x0148, - kHwVersion = 0x0151, - kHwVersionStr = 0x0152, - kManufacturingDate = 0x0153, - kUniqueId = 0x0154, + kSerialNumber = 0x0141, + kVendorId = 0x0142, + kVendorName = 0x0143, + kProductId = 0x0144, + kProductName = 0x0145, + kProductLabel = 0x0146, + kProductUrl = 0x0147, + kPartNumber = 0x0148, + kHwVersion = 0x0151, + kHwVersionStr = 0x0152, + kManufacturingDate = 0x0153, + kPersistentUniqueId = 0x0154, // Commissionable Data, kDiscriminator = 0x0161, kSpake2pPasscode = 0x0162, @@ -143,7 +143,7 @@ struct Storage : public GenericStorage, static constexpr size_t kPartNumberLengthMax = 32; static constexpr size_t kHardwareVersionStrLengthMax = 32; static constexpr size_t kManufacturingDateLengthMax = 11; // yyyy-mm-dd + \0 - static constexpr size_t kUniqueIdLengthMax = 16; + static constexpr size_t kPersistentUniqueIdMaxLength = 16; static constexpr size_t kSpake2pVerifierB64LengthMax = BASE64_ENCODED_LEN(chip::Crypto::kSpake2p_VerifierSerialized_Length) + 1; static constexpr size_t kSpake2pSaltB64LengthMax = BASE64_ENCODED_LEN(chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length) + 1; static constexpr size_t kFirmwareInfoSizeMax = 32; @@ -259,8 +259,10 @@ struct Storage : public GenericStorage, CHIP_ERROR SetHardwareVersionString(const char * value, size_t len); CHIP_ERROR SetManufacturingDate(const char * value, size_t len); CHIP_ERROR GetManufacturingDate(uint8_t * value, size_t max, size_t & size); - CHIP_ERROR SetUniqueId(const uint8_t * value, size_t size); - CHIP_ERROR GetUniqueId(uint8_t * value, size_t max, size_t & size); + // PersistentUniqueId is used to generate the RotatingUniqueId + // This PersistentUniqueId SHALL NOT be the same as the UniqueID attribute exposed in the Basic Information cluster. + CHIP_ERROR SetPersistentUniqueId(const uint8_t * value, size_t size); + CHIP_ERROR GetPersistentUniqueId(uint8_t * value, size_t max, size_t & size); // CommissionableDataProvider CHIP_ERROR SetSetupDiscriminator(uint16_t value); CHIP_ERROR SetSpake2pIterationCount(uint32_t value); diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index 176f396f44..75f118b38a 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -26,30 +26,25 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include - +#include "wfx_sl_ble_init.h" #include +#include #include #include #include #include +#include #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING #include #endif -#include -#ifdef __cplusplus extern "C" { -#endif -#include "wfx_sl_ble_init.h" #if !(SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #include #endif #include -#ifdef __cplusplus } -#endif #define BLE_MIN_CONNECTION_INTERVAL_MS 24 #define BLE_MAX_CONNECTION_INTERVAL_MS 40 diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h index f508c3396f..b28c810679 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -16,6 +16,10 @@ ******************************************************************************/ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include "rsi_ble_apis.h" #if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #include "rsi_bt_common_apis.h" @@ -24,6 +28,10 @@ #include #endif +#ifdef __cplusplus +} +#endif + #if SL_MATTER_GN_BUILD == 0 #include "sl_matter_wifi_config.h" #endif // SL_MATTER_GN_BUILD diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.cpp b/src/platform/silabs/rs911x/wfx_sl_ble_init.cpp index 971852592c..8916999381 100644 --- a/src/platform/silabs/rs911x/wfx_sl_ble_init.cpp +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.cpp @@ -20,9 +20,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include +#include using namespace chip::DeviceLayer::Internal; diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.h b/src/platform/silabs/rs911x/wfx_sl_ble_init.h index 54351674ef..4eaff9c067 100644 --- a/src/platform/silabs/rs911x/wfx_sl_ble_init.h +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.h @@ -22,22 +22,20 @@ */ #pragma once -/** - * Include files - * */ // BLE include file to refer BLE APIs #include "ble_config.h" #include "cmsis_os2.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" +#include +#include + +extern "C" { #include #include #include #include #include #include -#include -#include +} #define ATT_REC_IN_HOST (0) #define WFX_QUEUE_SIZE 10 diff --git a/src/platform/silabs/wifi/BUILD.gn b/src/platform/silabs/wifi/BUILD.gn new file mode 100644 index 0000000000..882a66deb4 --- /dev/null +++ b/src/platform/silabs/wifi/BUILD.gn @@ -0,0 +1,150 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/lwip.gni") +import("${chip_root}/src/platform/device.gni") +import("${chip_root}/third_party/silabs/efr32_sdk.gni") +import("${chip_root}/third_party/silabs/silabs_board.gni") + +declare_args() { + # Wifi related stuff - they are overridden by gn -args="use_wf200=true" + sl_wfx_config_softap = false + sl_wfx_config_scan = true + + # Argument to force enable WPA3 security on rs91x + rs91x_wpa3_transition = true + + #default WiFi SSID + chip_default_wifi_ssid = "" + + #default Wifi Password + chip_default_wifi_psk = "" +} + +if (chip_enable_wifi && !wifi_soc) { + assert(use_rs9116 || use_wf200 || use_SiWx917) + import("${chip_root}/src/platform/silabs/wifi/args.gni") + + if (use_rs9116) { + import("${silabs_platform_dir}/wifi/rs911x/rs911x.gni") + } else if (use_SiWx917) { + import("${silabs_platform_dir}/wifi/rs911x/rs9117.gni") + } + if (use_wf200) { + import("${silabs_platform_dir}/wifi/wf200/wf200.gni") + } +} + +config("wifi-platform-config") { + defines = [] + include_dirs = [] + + if (use_rs9116) { + # All the stuff from wiseconnect + include_dirs += rs911x_inc_plat + } else if (use_SiWx917) { + # All the stuff from wiseconnect + include_dirs += rs9117_inc_plat + } + + if (chip_default_wifi_ssid != "") { + defines += [ + "SL_ONNETWORK_PAIRING=1", + "SL_WIFI_SSID=\"${chip_default_wifi_ssid}\"", + ] + } + if (chip_default_wifi_psk != "") { + assert(chip_default_wifi_ssid != "", + "ssid can't be null if psk is provided") + defines += [ "SL_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] + } + + if (sl_wfx_config_softap) { + defines += [ "SL_WFX_CONFIG_SOFTAP" ] + } + + if (sl_wfx_config_scan) { + defines += [ "SL_WFX_CONFIG_SCAN" ] + } + + if (chip_enable_wifi_ipv4) { + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] + } + + if (rs91x_wpa3_transition) { + # TODO: Change this macro once WF200 support is provided + defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] + } + + # TODO: This defines needs to be here for the spi_multiplex.h configuration header. + # We need to find a better way to handle this. + if (!disable_lcd) { + defines += [ "DISPLAY_ENABLED" ] + } +} + +source_set("wifi-platform") { + sources = [ + "${silabs_platform_dir}/wifi/WifiInterfaceAbstraction.cpp", + "${silabs_platform_dir}/wifi/WifiInterfaceAbstraction.h", + "${silabs_platform_dir}/wifi/wfx_msgs.h", + ] + + public_configs = [ ":wifi-platform-config" ] + + public_deps = [ + "${chip_root}/src/app/icd/server:icd-server-config", + "${chip_root}/src/inet", + "${chip_root}/src/lib/support", + ] + + if (use_rs9116) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + } else if (use_SiWx917) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs9117_src_sapi + + #add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk + } else if (use_wf200) { + sources += wf200_plat_src + } + + if (wifi_soc) { + sources += [ + "${silabs_platform_dir}/wifi/SiWx/WifiInterface.cpp", + "${silabs_platform_dir}/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp", + "${silabs_platform_dir}/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h", + + # Wi-Fi Config - Using the file sdk support until the wiseconnect file is fixed + "${sdk_support_root}/components/service/network_manager/src/sl_net_for_lwip.c", + ] + + public_deps += [ "${lwip_root}:lwip" ] + } + + if (use_wf200 || use_rs9116) { + sources += [ + "${silabs_platform_dir}/wifi/lwip-support/dhcp_client.cpp", + "${silabs_platform_dir}/wifi/lwip-support/ethernetif.cpp", + "${silabs_platform_dir}/wifi/lwip-support/ethernetif.h", + "${silabs_platform_dir}/wifi/lwip-support/lwip_netif.cpp", + ] + } +} diff --git a/src/platform/silabs/wifi/SiWx/WifiInterface.cpp b/src/platform/silabs/wifi/SiWx/WifiInterface.cpp new file mode 100644 index 0000000000..0b4135a50a --- /dev/null +++ b/src/platform/silabs/wifi/SiWx/WifiInterface.cpp @@ -0,0 +1,905 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file implements the interface to the wifi sdk + */ + +#include +#include +#include + +#if (SL_MATTER_GN_BUILD == 0) +#include "sl_matter_wifi_config.h" +#endif // SL_MATTER_GN_BUILD + +#include "FreeRTOS.h" +#include "ble_config.h" +#include "event_groups.h" +#include "sl_status.h" +#include "sl_wifi_device.h" +#include "task.h" +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include "sl_si91x_driver.h" +#include "sl_si91x_host_interface.h" +#include "sl_si91x_types.h" +#include "sl_wifi.h" +#include "sl_wifi_callback_framework.h" +#include "sl_wifi_constants.h" +#include "sl_wifi_types.h" +#if SL_MBEDTLS_USE_TINYCRYPT +#include "sl_si91x_constants.h" +#include "sl_si91x_trng.h" +#endif // SL_MBEDTLS_USE_TINYCRYPT + +#include +#include +#include +#include +} + +#if SLI_SI91X_MCU_INTERFACE +#include "rsi_wisemcu_hardware_setup.h" +#endif // SLI_SI91X_MCU_INTERFACE + +#if (EXP_BOARD) +#include "rsi_bt_common_apis.h" +#include +#endif + +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE +#include "rsi_rom_power_save.h" +#include "sl_gpio_board.h" +#include "sl_si91x_driver_gpio.h" +#include "sl_si91x_power_manager.h" +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + +// Temmporary work-around for wifi-init failure in ACX modules with WiseConnect v3.3.3. This can be removed after integrating with +// WiseConnect v3.4.0 +#if (SL_SI91X_ACX_MODULE == 1) +#define REGION_CODE IGNORE_REGION +#else +#define REGION_CODE US +#endif + +WfxRsi_t wfx_rsi; +extern osSemaphoreId_t sl_rs_ble_init_sem; + +namespace { + +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE +// TODO: should be removed once we are getting the press interrupt for button 0 with sleep +bool btn0_pressed = false; +#ifdef ENABLE_CHIP_SHELL +bool ps_requirement_added = false; +#endif // ENABLE_CHIP_SHELL +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + +bool hasNotifiedWifiConnectivity = false; +bool hasNotifiedIPV6 = false; +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) +bool hasNotifiedIPV4 = false; +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + +wfx_wifi_scan_ext_t temp_reset; + +osSemaphoreId_t sScanCompleteSemaphore; +osSemaphoreId_t sScanInProgressSemaphore; +osTimerId_t sDHCPTimer; +osMessageQueueId_t sWifiEventQueue = nullptr; + +sl_net_wifi_lwip_context_t wifi_client_context; +sl_wifi_security_t security = SL_WIFI_SECURITY_UNKNOWN; + +const sl_wifi_device_configuration_t config = { + .boot_option = LOAD_NWP_FW, + .mac_address = NULL, + .band = SL_SI91X_WIFI_BAND_2_4GHZ, + .region_code = REGION_CODE, + .boot_config = { .oper_mode = SL_SI91X_CLIENT_MODE, + .coex_mode = SL_SI91X_WLAN_BLE_MODE, + .feature_bit_map = +#ifdef SLI_SI91X_MCU_INTERFACE + (SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE), +#else + (SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_AGGREGATION), +#endif + .tcp_ip_feature_bit_map = (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT | SL_SI91X_TCP_IP_FEAT_DNS_CLIENT | + SL_SI91X_TCP_IP_FEAT_SSL | SL_SI91X_TCP_IP_FEAT_BYPASS +#ifdef ipv6_FEATURE_REQUIRED + | SL_SI91X_TCP_IP_FEAT_DHCPV6_CLIENT | SL_SI91X_TCP_IP_FEAT_IPV6 +#endif + | SL_SI91X_TCP_IP_FEAT_ICMP | SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID), + .custom_feature_bit_map = (SL_SI91X_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP), + .ext_custom_feature_bit_map = (RSI_EXT_CUSTOM_FEATURE_BIT_MAP | (SL_SI91X_EXT_FEAT_BT_CUSTOM_FEAT_ENABLE) +#if (defined A2DP_POWER_SAVE_ENABLE) + | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2) +#endif + ), + .bt_feature_bit_map = (RSI_BT_FEATURE_BITMAP +#if (RSI_BT_GATT_ON_CLASSIC) + | SL_SI91X_BT_ATT_OVER_CLASSIC_ACL /* to support att over classic acl link */ +#endif + ), +#ifdef RSI_PROCESS_MAX_RX_DATA + .ext_tcp_ip_feature_bit_map = + (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID | SL_SI91X_EXT_TCP_MAX_RECV_LENGTH), +#else + .ext_tcp_ip_feature_bit_map = (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID), +#endif + //! ENABLE_BLE_PROTOCOL in bt_feature_bit_map + .ble_feature_bit_map = + ((SL_SI91X_BLE_MAX_NBR_PERIPHERALS(RSI_BLE_MAX_NBR_PERIPHERALS) | + SL_SI91X_BLE_MAX_NBR_CENTRALS(RSI_BLE_MAX_NBR_CENTRALS) | + SL_SI91X_BLE_MAX_NBR_ATT_SERV(RSI_BLE_MAX_NBR_ATT_SERV) | + SL_SI91X_BLE_MAX_NBR_ATT_REC(RSI_BLE_MAX_NBR_ATT_REC)) | + SL_SI91X_FEAT_BLE_CUSTOM_FEAT_EXTENTION_VALID | SL_SI91X_BLE_PWR_INX(RSI_BLE_PWR_INX) | + SL_SI91X_BLE_PWR_SAVE_OPTIONS(RSI_BLE_PWR_SAVE_OPTIONS) | SL_SI91X_916_BLE_COMPATIBLE_FEAT_ENABLE +#if RSI_BLE_GATT_ASYNC_ENABLE + | SL_SI91X_BLE_GATT_ASYNC_ENABLE +#endif + ), + + .ble_ext_feature_bit_map = ((SL_SI91X_BLE_NUM_CONN_EVENTS(RSI_BLE_NUM_CONN_EVENTS) | + SL_SI91X_BLE_NUM_REC_BYTES(RSI_BLE_NUM_REC_BYTES)) +#if RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST + | SL_SI91X_BLE_INDICATE_CONFIRMATION_FROM_HOST // indication response from app +#endif +#if RSI_BLE_MTU_EXCHANGE_FROM_HOST + | SL_SI91X_BLE_MTU_EXCHANGE_FROM_HOST // MTU Exchange request initiation from app +#endif +#if RSI_BLE_SET_SCAN_RESP_DATA_FROM_HOST + | (SL_SI91X_BLE_SET_SCAN_RESP_DATA_FROM_HOST) // Set SCAN Resp Data from app +#endif +#if RSI_BLE_DISABLE_CODED_PHY_FROM_HOST + | (SL_SI91X_BLE_DISABLE_CODED_PHY_FROM_HOST) // Disable Coded PHY from app +#endif +#if BLE_SIMPLE_GATT + | SL_SI91X_BLE_GATT_INIT +#endif + ), + .config_feature_bit_map = (SL_SI91X_FEAT_SLEEP_GPIO_SEL_BITMAP | RSI_CONFIG_FEATURE_BITMAP) } +}; + +constexpr int8_t kAdvScanThreshold = -40; +constexpr uint8_t kAdvRssiToleranceThreshold = 5; +constexpr uint8_t kAdvActiveScanDuration = 15; +constexpr uint8_t kAdvPassiveScanDuration = 20; +constexpr uint8_t kAdvMultiProbe = 1; +constexpr uint8_t kAdvScanPeriodicity = 10; + +// TODO: Confirm that this value works for size and timing +constexpr uint8_t kWfxQueueSize = 10; + +// TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else. +constexpr uint16_t kWifiScanTimeoutTicks = 10000; + +void DHCPTimerEventHandler(void * arg) +{ + WifiEvent event = WifiEvent::kStationDhcpPoll; + sl_matter_wifi_post_event(event); +} + +void CancelDHCPTimer(void) +{ + VerifyOrReturn(osTimerIsRunning(sDHCPTimer), ChipLogDetail(DeviceLayer, "CancelDHCPTimer: timer not running")); + VerifyOrReturn(osTimerStop(sDHCPTimer) == osOK, ChipLogError(DeviceLayer, "CancelDHCPTimer: failed to stop timer")); +} + +void StartDHCPTimer(uint32_t timeout) +{ + // Cancel timer if already started + CancelDHCPTimer(); + + VerifyOrReturn(osTimerStart(sDHCPTimer, pdMS_TO_TICKS(timeout)) == osOK, + ChipLogError(DeviceLayer, "StartDHCPTimer: failed to start timer")); +} + +sl_status_t sl_wifi_siwx917_init(void) +{ + sl_status_t status = SL_STATUS_OK; + +#ifdef SLI_SI91X_MCU_INTERFACE + // SoC Configurations + uint8_t xtal_enable = 1; + status = sl_si91x_m4_ta_secure_handshake(SL_SI91X_ENABLE_XTAL, 1, &xtal_enable, 0, nullptr); + VerifyOrReturnError(status == SL_STATUS_OK, status, + ChipLogError(DeviceLayer, "sl_si91x_m4_ta_secure_handshake failed: 0x%lx", static_cast(status))); + +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#ifdef ENABLE_CHIP_SHELL + // While using the matter shell with a Low Power Build, GPIO 1 is used to check the UULP PIN 1 status + // since UART doesn't act as a wakeup source in the UULP mode. + + // Configuring the NPS GPIO 1 + RSI_NPSSGPIO_SetPinMux(RTE_UULP_GPIO_1_PIN, 0); + + // Configure the NPSS GPIO direction to input + RSI_NPSSGPIO_SetDir(RTE_UULP_GPIO_1_PIN, 1); + + // Enable the REN + RSI_NPSSGPIO_InputBufferEn(RTE_UULP_GPIO_1_PIN, 1); +#endif // ENABLE_CHIP_SHELL +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + +#else + // NCP Configurations + status = sl_matter_wifi_platform_init(); + VerifyOrReturnError(status == SL_STATUS_OK, status, + ChipLogError(DeviceLayer, "sl_matter_wifi_platform_init failed: 0x%lx", static_cast(status))); +#endif // SLI_SI91X_MCU_INTERFACE + + sl_wifi_firmware_version_t version = { 0 }; + status = sl_wifi_get_firmware_version(&version); + VerifyOrReturnError(status == SL_STATUS_OK, status, + ChipLogError(DeviceLayer, "sl_wifi_get_firmware_version failed: 0x%lx", static_cast(status))); + + ChipLogDetail(DeviceLayer, "Firmware version is: %x%x.%d.%d.%d.%d.%d.%d", version.chip_id, version.rom_id, version.major, + version.minor, version.security_version, version.patch_num, version.customer_id, version.build_num); + + status = sl_wifi_get_mac_address(SL_WIFI_CLIENT_INTERFACE, (sl_mac_address_t *) &wfx_rsi.sta_mac.octet[0]); + VerifyOrReturnError(status == SL_STATUS_OK, status, + ChipLogError(DeviceLayer, "sl_wifi_get_mac_address failed: 0x%lx", static_cast(status))); + +#ifdef SL_MBEDTLS_USE_TINYCRYPT + constexpr uint32_t trngKey[TRNG_KEY_SIZE] = { 0x16157E2B, 0xA6D2AE28, 0x8815F7AB, 0x3C4FCF09 }; + + // To check the Entropy of TRNG and verify TRNG functioning. + status = sl_si91x_trng_entropy(); + VerifyOrReturnError(status == SL_STATUS_OK, status, + ChipLogError(DeviceLayer, "sl_si91x_trng_entropy failed: 0x%lx", static_cast(status))); + + // Initiate and program the key required for TRNG hardware engine + status = sl_si91x_trng_program_key((uint32_t *) trngKey, TRNG_KEY_SIZE); + VerifyOrReturnError(status == SL_STATUS_OK, status, + ChipLogError(DeviceLayer, "sl_si91x_trng_program_key failed: 0x%lx", static_cast(status))); +#endif // SL_MBEDTLS_USE_TINYCRYPT + + wfx_rsi.dev_state.Set(WifiState::kStationInit); + osSemaphoreRelease(sl_rs_ble_init_sem); + return status; +} + +// TODO: this changes will be reverted back after the Silabs WiFi SDK team fix the scan API +#ifndef EXP_BOARD +sl_status_t ScanCallback(sl_wifi_event_t event, sl_wifi_scan_result_t * scan_result, uint32_t result_length, void * arg) +{ + sl_status_t status = SL_STATUS_OK; + if (SL_WIFI_CHECK_IF_EVENT_FAILED(event)) + { + ChipLogError(DeviceLayer, "Scan Netwrok Failed: 0x%lx", *reinterpret_cast(status)); +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION + security = SL_WIFI_WPA3; +#else + security = SL_WIFI_WPA_WPA2_MIXED; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ + + status = SL_STATUS_FAIL; + } + else + { + security = static_cast(scan_result->scan_info[0].security_mode); + wfx_rsi.ap_chan = scan_result->scan_info[0].rf_channel; + memcpy(&wfx_rsi.ap_mac.octet, scan_result->scan_info[0].bssid, BSSID_LEN); + } + + osSemaphoreRelease(sScanCompleteSemaphore); + return status; +} +#endif + +sl_status_t InitiateScan() +{ + sl_status_t status = SL_STATUS_OK; + +// TODO: this changes will be reverted back after the Silabs WiFi SDK team fix the scan API +#ifndef EXP_BOARD + sl_wifi_ssid_t ssid = { 0 }; + + // TODO: this changes will be reverted back after the Silabs WiFi SDK team fix the scan API + sl_wifi_scan_configuration_t wifi_scan_configuration = default_wifi_scan_configuration; + + ssid.length = wfx_rsi.sec.ssid_length; + + // TODO: workaround because the string management with the null termination is flawed + chip::Platform::CopyString((char *) &ssid.value[0], ssid.length + 1, wfx_rsi.sec.ssid); + sl_wifi_set_scan_callback(ScanCallback, NULL); + + osSemaphoreAcquire(sScanInProgressSemaphore, osWaitForever); + + // This is an odd success code? + status = sl_wifi_start_scan(SL_WIFI_CLIENT_2_4GHZ_INTERFACE, &ssid, &wifi_scan_configuration); + if (status == SL_STATUS_IN_PROGRESS) + { + osSemaphoreAcquire(sScanCompleteSemaphore, kWifiScanTimeoutTicks); + status = SL_STATUS_OK; + } + + osSemaphoreRelease(sScanInProgressSemaphore); +#endif + + return status; +} + +sl_status_t SetWifiConfigurations() +{ + sl_status_t status = SL_STATUS_OK; + +#if CHIP_CONFIG_ENABLE_ICD_SERVER + // Setting the listen interval to 0 which will set it to DTIM interval + sl_wifi_listen_interval_t sleep_interval = { .listen_interval = 0 }; + status = sl_wifi_set_listen_interval(SL_WIFI_CLIENT_INTERFACE, sleep_interval); + VerifyOrReturnError(status == SL_STATUS_OK, status); + + sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 5 }; + status = sl_wifi_set_advanced_client_configuration(SL_WIFI_CLIENT_INTERFACE, &client_config); + VerifyOrReturnError(status == SL_STATUS_OK, status); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER + + status = sl_net_set_credential(SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID, SL_NET_WIFI_PSK, &wfx_rsi.sec.passkey[0], + wfx_rsi.sec.passkey_length); + VerifyOrReturnError(status == SL_STATUS_OK, status); + + sl_net_wifi_client_profile_t profile = { + .config = { + .ssid = { + //static cast because the types dont match + .length = static_cast(wfx_rsi.sec.ssid_length), + }, + .channel = { + .channel = SL_WIFI_AUTO_CHANNEL, + .band = SL_WIFI_AUTO_BAND, + .bandwidth = SL_WIFI_AUTO_BANDWIDTH + }, + .bssid = {{0}}, + .bss_type = SL_WIFI_BSS_TYPE_INFRASTRUCTURE, + .security = security, + .encryption = SL_WIFI_NO_ENCRYPTION, + .client_options = SL_WIFI_JOIN_WITH_SCAN, + .credential_id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID, + }, + .ip = { + .mode = SL_IP_MANAGEMENT_DHCP, + .type = SL_IPV6, + .host_name = NULL, + .ip = {{{0}}}, + } + }; + // TODO: memcpy for now since the types dont match + memcpy((char *) &profile.config.ssid.value, wfx_rsi.sec.ssid, wfx_rsi.sec.ssid_length); + + status = sl_net_set_profile((sl_net_interface_t) SL_NET_WIFI_CLIENT_INTERFACE, SL_NET_DEFAULT_WIFI_CLIENT_PROFILE_ID, &profile); + VerifyOrReturnError(status == SL_STATUS_OK, status, ChipLogError(DeviceLayer, "sl_net_set_profile Failed")); + + return status; +} + +sl_status_t JoinWifiNetwork(void) +{ + VerifyOrReturnError(!wfx_rsi.dev_state.HasAny(WifiState::kStationConnecting, WifiState::kStationConnected), + SL_STATUS_IN_PROGRESS); + sl_status_t status = SL_STATUS_OK; + + // Start Join Network + wfx_rsi.dev_state.Set(WifiState::kStationConnecting); + + status = SetWifiConfigurations(); + VerifyOrReturnError(status == SL_STATUS_OK, status, ChipLogError(DeviceLayer, "Failure to set the Wifi Configurations!")); + + status = sl_net_up((sl_net_interface_t) SL_NET_WIFI_CLIENT_INTERFACE, SL_NET_DEFAULT_WIFI_CLIENT_PROFILE_ID); + + if (status == SL_STATUS_OK || status == SL_STATUS_IN_PROGRESS) + { + WifiEvent event = WifiEvent::kStationConnect; + sl_matter_wifi_post_event(event); + return status; + } + + // failure only happens when the firmware returns an error + ChipLogError(DeviceLayer, "sl_wifi_connect failed: 0x%lx", static_cast(status)); + VerifyOrReturnError((wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT), status); + + wfx_rsi.dev_state.Clear(WifiState::kStationConnecting).Clear(WifiState::kStationConnected); + + ChipLogProgress(DeviceLayer, "Connection retry attempt %d", wfx_rsi.join_retries); + wfx_retry_connection(++wfx_rsi.join_retries); + + WifiEvent event = WifiEvent::kStationStartJoin; + sl_matter_wifi_post_event(event); + + return status; +} + +} // namespace + +/** + * @brief Wifi initialization called from app main + * + * @return sl_status_t Returns underlying Wi-Fi initialization error + */ +sl_status_t sl_matter_wifi_platform_init(void) +{ + sl_status_t status = SL_STATUS_OK; + + status = sl_net_init((sl_net_interface_t) SL_NET_WIFI_CLIENT_INTERFACE, &config, &wifi_client_context, nullptr); + VerifyOrReturnError(status == SL_STATUS_OK, status, ChipLogError(DeviceLayer, "sl_net_init failed: %lx", status)); + + // Create Sempaphore for scan completion + sScanCompleteSemaphore = osSemaphoreNew(1, 0, nullptr); + VerifyOrReturnError(sScanCompleteSemaphore != nullptr, SL_STATUS_ALLOCATION_FAILED); + + // Create Semaphore for scan in-progress protection + sScanInProgressSemaphore = osSemaphoreNew(1, 1, nullptr); + VerifyOrReturnError(sScanCompleteSemaphore != nullptr, SL_STATUS_ALLOCATION_FAILED); + + // Create the message queue + sWifiEventQueue = osMessageQueueNew(kWfxQueueSize, sizeof(WifiEvent), nullptr); + VerifyOrReturnError(sWifiEventQueue != nullptr, SL_STATUS_ALLOCATION_FAILED); + + // Create timer for DHCP polling + // TODO: Use LWIP timer instead of creating a new one here + sDHCPTimer = osTimerNew(DHCPTimerEventHandler, osTimerPeriodic, nullptr, nullptr); + VerifyOrReturnError(sDHCPTimer != nullptr, SL_STATUS_ALLOCATION_FAILED); + + return status; +} + +/****************************************************************** + * @fn int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t *ap) + * @brief + * Getting the AP details + * @param[in] ap: access point + * @return + * status + *********************************************************************/ +int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap) +{ + sl_status_t status = SL_STATUS_OK; + int32_t rssi = 0; + ap->ssid_length = wfx_rsi.sec.ssid_length; + ap->security = wfx_rsi.sec.security; + ap->chan = wfx_rsi.ap_chan; + chip::Platform::CopyString(ap->ssid, ap->ssid_length, wfx_rsi.sec.ssid); + memcpy(&ap->bssid[0], &wfx_rsi.ap_mac.octet[0], BSSID_LEN); + sl_wifi_get_signal_strength(SL_WIFI_CLIENT_INTERFACE, &rssi); + ap->rssi = rssi; + return status; +} + +/****************************************************************** + * @fn int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t *extra_info) + * @brief + * Getting the AP extra details + * @param[in] extra info: access point extra information + * @return + * status + *********************************************************************/ +int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info) +{ + sl_status_t status = SL_STATUS_OK; + sl_wifi_statistics_t test = { 0 }; + status = sl_wifi_get_statistics(SL_WIFI_CLIENT_INTERFACE, &test); + VERIFY_STATUS_AND_RETURN(status); + extra_info->beacon_lost_count = test.beacon_lost_count - temp_reset.beacon_lost_count; + extra_info->beacon_rx_count = test.beacon_rx_count - temp_reset.beacon_rx_count; + extra_info->mcast_rx_count = test.mcast_rx_count - temp_reset.mcast_rx_count; + extra_info->mcast_tx_count = test.mcast_tx_count - temp_reset.mcast_tx_count; + extra_info->ucast_rx_count = test.ucast_rx_count - temp_reset.ucast_rx_count; + extra_info->ucast_tx_count = test.ucast_tx_count - temp_reset.ucast_tx_count; + extra_info->overrun_count = test.overrun_count - temp_reset.overrun_count; + return status; +} + +/****************************************************************** + * @fn int32_t wfx_rsi_reset_count(void) + * @brief + * Getting the driver reset count + * @param[in] None + * @return + * status + *********************************************************************/ +int32_t wfx_rsi_reset_count(void) +{ + sl_wifi_statistics_t test = { 0 }; + sl_status_t status = SL_STATUS_OK; + status = sl_wifi_get_statistics(SL_WIFI_CLIENT_INTERFACE, &test); + VERIFY_STATUS_AND_RETURN(status); + temp_reset.beacon_lost_count = test.beacon_lost_count; + temp_reset.beacon_rx_count = test.beacon_rx_count; + temp_reset.mcast_rx_count = test.mcast_rx_count; + temp_reset.mcast_tx_count = test.mcast_tx_count; + temp_reset.ucast_rx_count = test.ucast_rx_count; + temp_reset.ucast_tx_count = test.ucast_tx_count; + temp_reset.overrun_count = test.overrun_count; + return status; +} + +/****************************************************************** + * @fn sl_wifi_platform_disconnect(void) + * @brief + * Getting the driver disconnect status + * @param[in] None + * @return + * status + *********************************************************************/ +int32_t sl_wifi_platform_disconnect(void) +{ + return sl_net_down((sl_net_interface_t) SL_NET_WIFI_CLIENT_INTERFACE); +} + +/****************************************************************** + * @fn wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) + * @brief + * Setting the RS911x in DTIM sleep based mode + * + * @param[in] sl_si91x_ble_state : State to set for the BLE + * @param[in] sl_si91x_wifi_state : State to set for the WiFi + * @return + * None + *********************************************************************/ +int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) +{ + int32_t status; + + status = rsi_bt_power_save_profile(sl_si91x_ble_state, 0); + if (status != RSI_SUCCESS) + { + ChipLogError(DeviceLayer, "rsi_bt_power_save_profile failed: 0x%lx", static_cast(status)); + return status; + } + sl_wifi_performance_profile_t wifi_profile = { .profile = sl_si91x_wifi_state }; + status = sl_wifi_set_performance_profile(&wifi_profile); + if (status != RSI_SUCCESS) + { + ChipLogError(DeviceLayer, "sl_wifi_set_performance_profile failed: 0x%lx", static_cast(status)); + return status; + } + + return status; +} + +sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result) +{ + SL_WIFI_ARGS_CHECK_NULL_POINTER(scan_result); + VerifyOrReturnError(wfx_rsi.scan_cb != nullptr, SL_STATUS_INVALID_HANDLE); + + wfx_wifi_scan_result_t cur_scan_result; + for (int idx = 0; idx < (int) scan_result->scan_count; idx++) + { + memset(&cur_scan_result, 0, sizeof(cur_scan_result)); + + cur_scan_result.ssid_length = strnlen((char *) scan_result->scan_info[idx].ssid, + std::min(sizeof(scan_result->scan_info[idx].ssid), WFX_MAX_SSID_LENGTH)); + chip::Platform::CopyString(cur_scan_result.ssid, cur_scan_result.ssid_length, (char *) scan_result->scan_info[idx].ssid); + + // if user has provided ssid, then check if the current scan result ssid matches the user provided ssid + if (wfx_rsi.scan_ssid != nullptr && + (strncmp(wfx_rsi.scan_ssid, cur_scan_result.ssid, std::min(strlen(wfx_rsi.scan_ssid), strlen(cur_scan_result.ssid))) == + 0)) + { + continue; + } + cur_scan_result.security = static_cast(scan_result->scan_info[idx].security_mode); + cur_scan_result.rssi = (-1) * scan_result->scan_info[idx].rssi_val; + memcpy(cur_scan_result.bssid, scan_result->scan_info[idx].bssid, BSSID_LEN); + wfx_rsi.scan_cb(&cur_scan_result); + + // if user has not provided the ssid, then call the callback for each scan result + if (wfx_rsi.scan_ssid == nullptr) + { + continue; + } + break; + } + + // cleanup and return + wfx_rsi.dev_state.Clear(WifiState::kScanStarted); + wfx_rsi.scan_cb((wfx_wifi_scan_result_t *) 0); + wfx_rsi.scan_cb = nullptr; + if (wfx_rsi.scan_ssid) + { + chip::Platform::MemoryFree(wfx_rsi.scan_ssid); + wfx_rsi.scan_ssid = nullptr; + } + return SL_STATUS_OK; +} + +sl_status_t bg_scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * result, uint32_t result_length, void * arg) +{ + show_scan_results(result); // To do Check error + osSemaphoreRelease(sScanCompleteSemaphore); + return SL_STATUS_OK; +} + +/// NotifyConnectivity +/// @brief Notify the application about the connectivity status if it has not been notified yet. +/// Helper function for HandleDHCPPolling. +void NotifyConnectivity(void) +{ + VerifyOrReturn(!hasNotifiedWifiConnectivity); + wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac); + hasNotifiedWifiConnectivity = true; +} + +void HandleDHCPPolling(void) +{ + WifiEvent event; + + // TODO: Notify the application that the interface is not set up or Chipdie here because we are in an unkonwn state + struct netif * sta_netif = &wifi_client_context.netif; + VerifyOrReturn(sta_netif != nullptr, ChipLogError(DeviceLayer, "HandleDHCPPolling: failed to get STA netif")); + +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) + uint8_t dhcp_state = dhcpclient_poll(sta_netif); + if (dhcp_state == DHCP_ADDRESS_ASSIGNED && !hasNotifiedIPV4) + { + wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr); + hasNotifiedIPV4 = true; + event = WifiEvent::kStationDhcpDone; + sl_matter_wifi_post_event(event); + NotifyConnectivity(); + } + else if (dhcp_state == DHCP_OFF) + { + wfx_ip_changed_notify(IP_STATUS_FAIL); + hasNotifiedIPV4 = false; + } +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + /* Checks if the assigned IPv6 address is preferred by evaluating + * the first block of IPv6 address ( block 0) + */ + if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && !hasNotifiedIPV6) + { + char addrStr[chip::Inet::IPAddress::kMaxStringLength] = { 0 }; + VerifyOrReturn(ip6addr_ntoa_r(netif_ip6_addr(sta_netif, 0), addrStr, sizeof(addrStr)) != nullptr); + ChipLogProgress(DeviceLayer, "SLAAC OK: linklocal addr: %s", addrStr); + wfx_ipv6_notify(GET_IPV6_SUCCESS); + hasNotifiedIPV6 = true; + event = WifiEvent::kStationDhcpDone; + sl_matter_wifi_post_event(event); + NotifyConnectivity(); + } +} +void sl_matter_wifi_post_event(WifiEvent event) +{ + sl_status_t status = osMessageQueuePut(sWifiEventQueue, &event, 0, 0); + + if (status != osOK) + { + ChipLogError(DeviceLayer, "sl_matter_wifi_post_event: failed to post event with status: %ld", status); + // TODO: Handle error, requeue event depending on queue size or notify relevant task, + // Chipdie, etc. + } +} +/// ResetDHCPNotificationFlags +/// @brief Reset the flags that are used to notify the application about DHCP connectivity +/// and emits a WifiEvent::kStationDoDhcp event to trigger DHCP polling checks. Helper function for ProcessEvent. +void ResetDHCPNotificationFlags(void) +{ + +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) + hasNotifiedIPV4 = false; +#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4 + hasNotifiedIPV6 = false; + hasNotifiedWifiConnectivity = false; + + WifiEvent event = WifiEvent::kStationDoDhcp; + sl_matter_wifi_post_event(event); +} + +void ProcessEvent(WifiEvent event) +{ + // Process event + switch (event) + { + case WifiEvent::kStationConnect: + ChipLogDetail(DeviceLayer, "WifiEvent::kStationConnect"); + wfx_rsi.dev_state.Set(WifiState::kStationConnected); + ResetDHCPNotificationFlags(); + break; + + case WifiEvent::kStationDisconnect: { + ChipLogDetail(DeviceLayer, "WifiEvent::kStationDisconnect"); + // TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something + + wfx_rsi.dev_state.Clear(WifiState::kStationReady) + .Clear(WifiState::kStationConnecting) + .Clear(WifiState::kStationConnected) + .Clear(WifiState::kStationDhcpDone); + + /* TODO: Implement disconnect notify */ + ResetDHCPNotificationFlags(); +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) + wfx_ip_changed_notify(0); // for IPV4 + wfx_ip_changed_notify(IP_STATUS_FAIL); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + wfx_ipv6_notify(GET_IPV6_FAIL); + } + break; + + case WifiEvent::kAPStart: + // TODO: Currently unimplemented + break; + + case WifiEvent::kScan: + ChipLogDetail(DeviceLayer, "WifiEvent::kScan"); + +#ifdef SL_WFX_CONFIG_SCAN + if (!(wfx_rsi.dev_state.Has(WifiState::kScanStarted))) + { + ChipLogDetail(DeviceLayer, "WifiEvent::kScan"); + sl_wifi_scan_configuration_t wifi_scan_configuration; + memset(&wifi_scan_configuration, 0, sizeof(wifi_scan_configuration)); + + // TODO: Add scan logic + sl_wifi_advanced_scan_configuration_t advanced_scan_configuration = { 0 }; + int32_t status; + advanced_scan_configuration.active_channel_time = kAdvActiveScanDuration; + advanced_scan_configuration.passive_channel_time = kAdvPassiveScanDuration; + advanced_scan_configuration.trigger_level = kAdvScanThreshold; + advanced_scan_configuration.trigger_level_change = kAdvRssiToleranceThreshold; + advanced_scan_configuration.enable_multi_probe = kAdvMultiProbe; + status = sl_wifi_set_advanced_scan_configuration(&advanced_scan_configuration); + if (SL_STATUS_OK != status) + { + // TODO: Seems like Chipdie should be called here, the device should be initialized here + ChipLogError(DeviceLayer, "sl_wifi_set_advanced_scan_configuration failed: 0x%lx", static_cast(status)); + return; + } + + if (wfx_rsi.dev_state.Has(WifiState::kStationConnected)) + { + /* Terminate with end of scan which is no ap sent back */ + wifi_scan_configuration.type = SL_WIFI_SCAN_TYPE_ADV_SCAN; + wifi_scan_configuration.periodic_scan_interval = kAdvScanPeriodicity; + } + else + { + wifi_scan_configuration = default_wifi_scan_configuration; + } + sl_wifi_set_scan_callback(bg_scan_callback_handler, nullptr); + wfx_rsi.dev_state.Set(WifiState::kScanStarted); + + osSemaphoreAcquire(sScanInProgressSemaphore, osWaitForever); + status = sl_wifi_start_scan(SL_WIFI_CLIENT_2_4GHZ_INTERFACE, nullptr, &wifi_scan_configuration); + if (SL_STATUS_IN_PROGRESS == status) + { + osSemaphoreAcquire(sScanCompleteSemaphore, kWifiScanTimeoutTicks); + } + + osSemaphoreRelease(sScanInProgressSemaphore); + } +#endif /* SL_WFX_CONFIG_SCAN */ + break; + + case WifiEvent::kStationStartJoin: + ChipLogDetail(DeviceLayer, "WifiEvent::kStationStartJoin"); + + InitiateScan(); + JoinWifiNetwork(); + break; + + case WifiEvent::kStationDoDhcp: + ChipLogDetail(DeviceLayer, "WifiEvent::kStationDoDhcp"); + StartDHCPTimer(WFX_RSI_DHCP_POLL_INTERVAL); + break; + + case WifiEvent::kStationDhcpDone: + ChipLogDetail(DeviceLayer, "WifiEvent::kStationDhcpDone"); + CancelDHCPTimer(); + break; + + case WifiEvent::kStationDhcpPoll: + ChipLogDetail(DeviceLayer, "WifiEvent::kStationDhcpPoll"); + HandleDHCPPolling(); + break; + + default: + break; + } +} + +/********************************************************************************* + * @fn void sl_matter_wifi_task(void *arg) + * @brief + * The main WLAN task - started by wfx_wifi_start() that interfaces with RSI. + * The rest of RSI stuff come in call-backs. + * The initialization has been already done. + * @param[in] arg: + * @return + * None + **********************************************************************************/ +/* ARGSUSED */ +void sl_matter_wifi_task(void * arg) +{ + (void) arg; + WifiEvent event; + sl_status_t status = SL_STATUS_OK; + + status = sl_wifi_siwx917_init(); + VerifyOrReturn( + status == SL_STATUS_OK, + ChipLogError(DeviceLayer, "sl_matter_wifi_task: sl_wifi_siwx917_init failed: 0x%lx", static_cast(status))); + + sl_matter_wifi_task_started(); + + ChipLogDetail(DeviceLayer, "sl_matter_wifi_task: starting event loop"); + for (;;) + { + if (osMessageQueueGet(sWifiEventQueue, &event, nullptr, osWaitForever) == osOK) + { + ProcessEvent(event); + } + else + { + ChipLogError(DeviceLayer, "sl_matter_wifi_task: get event failed: 0x%lx", static_cast(status)); + } + } +} + +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 +/******************************************************************************************** + * @fn void wfx_dhcp_got_ipv4(uint32_t ip) + * @brief + * Acquire the new ip address + * @param[in] ip: internet protocol + * @return + * None + **********************************************************************************************/ +void wfx_dhcp_got_ipv4(uint32_t ip) +{ + /* + * Acquire the new IP address + */ + wfx_rsi.ip4_addr[0] = (ip) &0xFF; + wfx_rsi.ip4_addr[1] = (ip >> 8) & 0xFF; + wfx_rsi.ip4_addr[2] = (ip >> 16) & 0xFF; + wfx_rsi.ip4_addr[3] = (ip >> 24) & 0xFF; + ChipLogDetail(DeviceLayer, "DHCP OK: IP=%d.%d.%d.%d", wfx_rsi.ip4_addr[0], wfx_rsi.ip4_addr[1], wfx_rsi.ip4_addr[2], + wfx_rsi.ip4_addr[3]); + /* Notify the Connectivity Manager - via the app */ + wfx_rsi.dev_state.Set(WifiState::kStationDhcpDone).Set(WifiState::kStationReady); + wfx_ip_changed_notify(IP_STATUS_SUCCESS); +} +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + +#if SL_ICD_ENABLED +/********************************************************************* + * @fn sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t + sl_si91x_wifi_state) + * @brief + * Implements the power save in sleepy application + * @param[in] sl_si91x_ble_state : State to set for the BLE + sl_si91x_wifi_state : State to set for the WiFi + * @return SL_STATUS_OK if successful, + * SL_STATUS_FAIL otherwise + ***********************************************************************/ +sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, + sl_si91x_performance_profile_t sl_si91x_wifi_state) // TODO : Figure out why the extern C is necessary +{ + return (wfx_rsi_power_save(sl_si91x_ble_state, sl_si91x_wifi_state) ? SL_STATUS_FAIL : SL_STATUS_OK); +} +#endif diff --git a/examples/platform/silabs/wifi/wfx_notify.cpp b/src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp similarity index 85% rename from examples/platform/silabs/wifi/wfx_notify.cpp rename to src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp index de1becacb3..430b9bbddb 100644 --- a/examples/platform/silabs/wifi/wfx_notify.cpp +++ b/src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp @@ -15,41 +15,41 @@ * limitations under the License. */ -#include "AppConfig.h" -#include "BaseApplication.h" +// SL MATTER WI-FI INTERFACE + +#include "silabs_utils.h" #include +#include +#include +#include +#include +#include #include #include #include -#include "FreeRTOS.h" -#include "event_groups.h" -#include "silabs_utils.h" -#include "task.h" -#include "wfx_host_events.h" +using namespace chip; +using namespace chip::DeviceLayer; -#ifdef RS911X_WIFI -#include "wfx_rsi.h" -#endif +#define CONVERT_SEC_TO_MS(TimeInS) (TimeInS * 1000) -#include - -using namespace ::chip; -using namespace ::chip::DeviceLayer; +// TODO: This is a workaround because we depend on the platform lib which depends on the platform implementation. +// As such we can't depend on the platform here as well +extern void HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData); namespace { + constexpr uint8_t kWlanMinRetryIntervalsInSec = 1; constexpr uint8_t kWlanMaxRetryIntervalsInSec = 60; constexpr uint8_t kWlanRetryIntervalInSec = 5; uint8_t retryInterval = kWlanMinRetryIntervalsInSec; osTimerId_t sRetryTimer; -} // namespace + /* * Notifications to the upper-layer * All done in the context of the RSI/WiFi task (rsi_if.c) */ - -static void RetryConnectionTimerHandler(void * arg) +void RetryConnectionTimerHandler(void * arg) { #if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE wfx_rsi_power_save(RSI_ACTIVE, HIGH_PERFORMANCE); @@ -59,14 +59,17 @@ static void RetryConnectionTimerHandler(void * arg) ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); } } + +} // namespace + /*********************************************************************************** - * @fn wfx_started_notify(void) + * @fn sl_matter_wifi_task_started(void) * @brief * Wifi device started notification * @param[in]: None * @return None *************************************************************************************/ -void wfx_started_notify(void) +void sl_matter_wifi_task_started(void) { sl_wfx_startup_ind_t evt; sl_wfx_mac_address_t mac; @@ -82,7 +85,7 @@ void wfx_started_notify(void) wfx_get_wifi_mac_addr(SL_WFX_STA_INTERFACE, &mac); memcpy(&evt.body.mac_addr[0], &mac.octet[0], MAC_ADDRESS_FIRST_OCTET); - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); + HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); } /*********************************************************************************** @@ -109,7 +112,7 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap) #endif memcpy(&evt.body.mac[0], &ap->octet[0], MAC_ADDRESS_FIRST_OCTET); - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); + HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); } /************************************************************************************** @@ -118,7 +121,7 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap) * notification of disconnection * @param[in] status: * @return None - ********************************************************************************************/ + *************************************************************************************/ void wfx_disconnected_notify(int32_t status) { sl_wfx_disconnect_ind_t evt; @@ -127,7 +130,7 @@ void wfx_disconnected_notify(int32_t status) evt.header.id = SL_WFX_DISCONNECT_IND_ID; evt.header.length = sizeof evt; evt.body.reason = status; - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); + HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); } /************************************************************************************** @@ -136,7 +139,7 @@ void wfx_disconnected_notify(int32_t status) * notification of ipv6 * @param[in] got_ip: * @return None - ********************************************************************************************/ + *************************************************************************************/ void wfx_ipv6_notify(int got_ip) { sl_wfx_generic_message_t eventData; @@ -144,7 +147,7 @@ void wfx_ipv6_notify(int got_ip) memset(&eventData, 0, sizeof(eventData)); eventData.header.id = got_ip ? IP_EVENT_GOT_IP6 : IP_EVENT_STA_LOST_IP; eventData.header.length = sizeof(eventData.header); - PlatformMgrImpl().HandleWFXSystemEvent(IP_EVENT, &eventData); + HandleWFXSystemEvent(IP_EVENT, &eventData); } /************************************************************************************** @@ -153,7 +156,7 @@ void wfx_ipv6_notify(int got_ip) * notification of ip change * @param[in] got_ip: * @return None - ********************************************************************************************/ + *************************************************************************************/ void wfx_ip_changed_notify(int got_ip) { sl_wfx_generic_message_t eventData; @@ -161,7 +164,7 @@ void wfx_ip_changed_notify(int got_ip) memset(&eventData, 0, sizeof(eventData)); eventData.header.id = got_ip ? IP_EVENT_STA_GOT_IP : IP_EVENT_STA_LOST_IP; eventData.header.length = sizeof(eventData.header); - PlatformMgrImpl().HandleWFXSystemEvent(IP_EVENT, &eventData); + HandleWFXSystemEvent(IP_EVENT, &eventData); } /************************************************************************************** @@ -172,11 +175,11 @@ void wfx_ip_changed_notify(int got_ip) * with AP continously after a certain time interval. * @param[in] retryAttempt * @return None - ********************************************************************************************/ + *************************************************************************************/ void wfx_retry_connection(uint16_t retryAttempt) { // During commissioning, we retry to join the network MAX_JOIN_RETRIES_COUNT - if (BaseApplication::sAppDelegate.isCommissioningInProgress()) + if (/*BaseApplication::sAppDelegate.isCommissioningInProgress()*/ true) { if (retryAttempt < MAX_JOIN_RETRIES_COUNT) { diff --git a/src/platform/silabs/wifi/wfx_host_events.h b/src/platform/silabs/wifi/WifiInterfaceAbstraction.h similarity index 55% rename from src/platform/silabs/wifi/wfx_host_events.h rename to src/platform/silabs/wifi/WifiInterfaceAbstraction.h index 3bd973467b..f6364d040e 100644 --- a/src/platform/silabs/wifi/wfx_host_events.h +++ b/src/platform/silabs/wifi/WifiInterfaceAbstraction.h @@ -14,9 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #pragma once +#include +#include +#include +#include +#include + #include "sl_status.h" #include @@ -32,6 +37,12 @@ #include "sl_wifi_constants.h" #include "sl_wifi_device.h" +/* + * Interface to RSI Sapis + */ + +#define WFX_RSI_DHCP_POLL_INTERVAL (250) /* Poll interval in ms for DHCP */ + // MAX SSID LENGTH excluding NULL character #define WFX_MAX_SSID_LENGTH (32) // MAX PASSKEY LENGTH including NULL character @@ -44,106 +55,56 @@ #define WFX_MAX_PASSKEY_LENGTH (64) #endif // (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) -#define CONVERT_SEC_TO_MS(TimeInS) (TimeInS * 1000) - -/* Wi-Fi bitmask events - for the task */ -#define SL_WFX_CONNECT (1 << 1) -#define SL_WFX_DISCONNECT (1 << 2) -#define SL_WFX_START_AP (1 << 3) -#define SL_WFX_STOP_AP (1 << 4) -#define SL_WFX_SCAN_START (1 << 5) -#define SL_WFX_SCAN_COMPLETE (1 << 6) -#define SL_WFX_RETRY_CONNECT (1 << 7) - -// WLAN MAX retry #define MAX_JOIN_RETRIES_COUNT (5) - -#define WLAN_TASK_STACK_SIZE (1024) - -// WLAN related Macros -#define ETH_FRAME (0) -#define CMP_SUCCESS (0) #define BSSID_LEN (6) #define MAC_ADDRESS_FIRST_OCTET (6) -#define AP_START_SUCCESS (0) -#define BITS_TO_WAIT (0) #define CONNECTION_STATUS_SUCCESS (1) #define IP_STATUS_FAIL (0) -#define GET_IPV6_SUCCESS (1) #define GET_IPV6_FAIL (0) -#define BEACON_1 (0) -#define CHANNEL_LIST ((const uint8_t *) 0) -#define CHANNEL_COUNT (0) -#define IE_DATA ((const uint8_t *) 0) -#define IE_DATA_LENGTH (0) -#define BSSID_SCAN ((const uint8_t *) 0) -#define CHANNEL_0 (0) -#define PREVENT_ROAMING (1) -#define DISABLE_PMF_MODE (0) -#define STA_IP_FAIL (0) #define IP_STATUS_SUCCESS (1) -#define ACTIVE_CHANNEL_TIME_100 (100) -#define PASSIVE_CHANNEL_TIME_0 (0) -#define PROBE_NUM_REQ_1 (1) -#define PINOUT_CLEAR_STATUS (0) -#define TICKS_TO_WAIT_0 (0) -#define TICKS_TO_WAIT_3 (3) -#define TICKS_TO_WAIT_1 (1) -#define TICKS_TO_WAIT_500 (500) +#define SL_WFX_STARTUP_IND_ID (1) +#define SL_WFX_CONNECT_IND_ID (2) +#define SL_WFX_DISCONNECT_IND_ID (3) +#define SL_WFX_SCAN_COMPLETE_ID (4) // TASK and Interrupt Macros #define SUCCESS_STATUS (1) -#define LINK_UP (1) -#define LINK_DOWN (0) -#define MAC_48_BIT_SET (1) -#define STRUCT_PBUF ((struct pbuf *) 0) -#define PRIORITY_0 (0) -#define HEX_VALUE_FF (0XFF) - -// Timer Delay -#define MAX_XLEN (16) -#define MIN_XLEN (0) -#define PINOUT_CLEAR (0) -#define PINOUT_SET (1) -#define WFX_SPI_NVIC_PRIORITY (5) -#define WFX_GPIO_NVIC_PRIORITY (5) -#define CB_VALUE ((DMADRV_Callback_t) 0) - -/* TIMER_TICKS_TO_WAIT Specifies the time, in ticks, that the calling task should - * be held in the Blocked state to wait for the start command to be successfully - * sent to the timer command queue. - */ -#define TIMER_TICKS_TO_WAIT_0 pdMS_TO_TICKS(0) - -#define CONVERT_SEC_TO_MSEC (1000) -#define CONVERT_USEC_TO_MSEC (1 / 1000) - -#define RSI_RESPONSE_MAX_SIZE (28) -#define RSI_RESPONSE_HOLD_BUFF_SIZE (128) -#define RSI_DRIVER_STATUS (0) -#define OPER_MODE_0 (0) -#define COEX_MODE_0 (0) -#define RESP_BUFF_SIZE (6) -#define AP_CHANNEL_NO_0 (0) -#define SCAN_BITMAP_OPTN_1 (1) -#define IP_CONF_RSP_BUFF_LENGTH_4 (4) -#define STATION (0) - -#define SPI_CONFIG_SUCCESS (0) + +enum class WifiState : uint16_t +{ + kStationInit = (1 << 0), + kAPReady = (1 << 1), + kStationProvisioned = (1 << 2), + kStationConnecting = (1 << 3), + kStationConnected = (1 << 4), + kStationDhcpDone = (1 << 6), /* Requested to do DHCP after conn */ + kStationMode = (1 << 7), /* Enable Station Mode */ + kAPMode = (1 << 8), /* Enable AP Mode */ + kStationReady = (kStationConnected | kStationDhcpDone), + kStationStarted = (1 << 9), /* RSI task started */ + kScanStarted = (1 << 10), /* Scan Started */ +}; + +enum class WifiEvent : uint8_t +{ + kStationConnect = 0, + kStationDisconnect = 1, + kAPStart = 2, + kAPStop = 3, + kScan = 4, /* This is used as scan result and start */ + kStationStartJoin = 5, + kStationDoDhcp = 6, + kStationDhcpDone = 7, + kStationDhcpPoll = 8 +}; + typedef enum { WIFI_EVENT, IP_EVENT, } wfx_event_base_t; -typedef enum -{ - IP_EVENT_STA_GOT_IP, - IP_EVENT_GOT_IP6, - IP_EVENT_STA_LOST_IP, -} ip_event_id_t; - /* Note that these are same as RSI_security */ typedef enum { @@ -195,6 +156,13 @@ typedef struct wfx_wifi_scan_ext uint32_t overrun_count; } wfx_wifi_scan_ext_t; +typedef enum +{ + IP_EVENT_STA_GOT_IP, + IP_EVENT_GOT_IP6, + IP_EVENT_STA_LOST_IP, +} ip_event_id_t; + #ifdef RS911X_WIFI /* * This Sh%t is here to support WFXUtils - and the Matter stuff that uses it @@ -205,121 +173,50 @@ typedef enum SL_WFX_STA_INTERFACE = 0, ///< Interface 0, linked to the station SL_WFX_SOFTAP_INTERFACE = 1, ///< Interface 1, linked to the softap } sl_wfx_interface_t; -#endif /* RS911X_WIFI */ - -#ifdef WF200_WIFI -#include "FreeRTOS.h" -#include "event_groups.h" -#include "semphr.h" -#include "sl_wfx_cmd_api.h" -#include "sl_wfx_constants.h" -#include "task.h" -#include "timers.h" - -#define WLAN_TASK_PRIORITY (1) -typedef struct __attribute__((__packed__)) sl_wfx_get_counters_cnf_body_s -{ - uint32_t status; - uint16_t mib_id; - uint16_t length; - uint32_t rcpi; - uint32_t count_plcp_errors; - uint32_t count_fcs_errors; - uint32_t count_tx_packets; - uint32_t count_rx_packets; - uint32_t count_rx_packet_errors; - uint32_t count_rx_decryption_failures; - uint32_t count_rx_mic_failures; - uint32_t count_rx_no_key_failures; - uint32_t count_tx_multicast_frames; - uint32_t count_tx_frames_success; - uint32_t count_tx_frame_failures; - uint32_t count_tx_frames_retried; - uint32_t count_tx_frames_multi_retried; - uint32_t count_rx_frame_duplicates; - uint32_t count_rts_success; - uint32_t count_rts_failures; - uint32_t count_ack_failures; - uint32_t count_rx_multicast_frames; - uint32_t count_rx_frames_success; - uint32_t count_rx_cmacicv_errors; - uint32_t count_rx_cmac_replays; - uint32_t count_rx_mgmt_ccmp_replays; - uint32_t count_rx_bipmic_errors; - uint32_t count_rx_beacon; - uint32_t count_miss_beacon; - uint32_t reserved[15]; -} sl_wfx_get_counters_cnf_body_t; - -typedef struct __attribute__((__packed__)) sl_wfx_get_counters_cnf_s -{ - /** Common message header. */ - sl_wfx_header_t header; - /** Confirmation message body. */ - sl_wfx_get_counters_cnf_body_t body; -} sl_wfx_get_counters_cnf_t; - -typedef struct __attribute__((__packed__)) sl_wfx_mib_req_body_s -{ - uint16_t mib_id; ///< ID of the MIB to be read. - uint16_t reserved; -} sl_wfx_mib_req_body_t; +#endif -typedef struct __attribute__((__packed__)) sl_wfx_header_mib_s -{ - uint16_t length; ///< Message length in bytes including this uint16_t. - ///< Maximum value is 8188 but maximum Request size is FW dependent and reported in the - ///< ::sl_wfx_startup_ind_body_t::size_inp_ch_buf. - uint8_t id; ///< Contains the message Id indexed by sl_wfx_general_commands_ids_t or sl_wfx_message_ids_t. - uint8_t reserved : 1; - uint8_t interface : 2; - uint8_t seqnum : 3; - uint8_t encrypted : 2; -} sl_wfx_header_mib_t; - -typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s +typedef struct wfx_rsi_s { - /** Common message header. */ - sl_wfx_header_mib_t header; - /** Request message body. */ - sl_wfx_mib_req_body_t body; -} sl_wfx_mib_req_t; - -#else /* End WF200 else RS9116,917 NCP and 917 SoC */ - -#include "wfx_msgs.h" -/* Wi-Fi events*/ -#define SL_WFX_STARTUP_IND_ID (1) -#define SL_WFX_CONNECT_IND_ID (2) -#define SL_WFX_DISCONNECT_IND_ID (3) -#define SL_WFX_SCAN_COMPLETE_ID (4) -#endif /* WF200_WIFI */ - -#ifdef __cplusplus -extern "C" { + chip::BitFlags dev_state; + uint16_t ap_chan; /* The chan our STA is using */ + wfx_wifi_provision_t sec; +#ifdef SL_WFX_CONFIG_SCAN + void (*scan_cb)(wfx_wifi_scan_result_t *); + char * scan_ssid; /* Which one are we scanning for */ + size_t scan_ssid_length; +#endif +#ifdef SL_WFX_CONFIG_SOFTAP + sl_wfx_mac_address_t softap_mac; #endif + sl_wfx_mac_address_t sta_mac; + sl_wfx_mac_address_t ap_mac; /* To which our STA is connected */ + sl_wfx_mac_address_t ap_bssid; /* To which our STA is connected */ + uint16_t join_retries; + uint8_t ip4_addr[4]; /* Not sure if this is enough */ +} WfxRsi_t; + +// TODO: We shouldn't need to have access to a global variable in the interface here +extern WfxRsi_t wfx_rsi; -void sl_wfx_host_gpio_init(void); sl_status_t wfx_wifi_start(void); void wfx_enable_sta_mode(void); - void wfx_get_wifi_mac_addr(sl_wfx_interface_t interface, sl_wfx_mac_address_t * addr); void wfx_set_wifi_provision(wfx_wifi_provision_t * wifiConfig); bool wfx_get_wifi_provision(wfx_wifi_provision_t * wifiConfig); - bool wfx_is_sta_mode_enabled(void); int32_t wfx_get_ap_info(wfx_wifi_scan_result_t * ap); int32_t wfx_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_reset_counts(); - void wfx_clear_wifi_provision(void); sl_status_t wfx_connect_to_ap(void); void wfx_setup_ip6_link_local(sl_wfx_interface_t); bool wfx_is_sta_connected(void); -sl_status_t wfx_sta_discon(void); +sl_status_t sl_matter_wifi_disconnect(void); + #if CHIP_DEVICE_CONFIG_ENABLE_IPV4 bool wfx_have_ipv4_addr(sl_wfx_interface_t); #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + bool wfx_have_ipv6_addr(sl_wfx_interface_t); wifi_mode_t wfx_get_wifi_mode(void); bool wfx_start_scan(char * ssid, void (*scan_cb)(wfx_wifi_scan_result_t *)); /* true returned if successfully started */ @@ -328,17 +225,16 @@ void wfx_cancel_scan(void); /* * Call backs into the Matter Platform code */ -void wfx_started_notify(void); +void sl_matter_wifi_task_started(void); void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap); void wfx_disconnected_notify(int32_t status); + /* Implemented for LWIP */ -void wfx_host_received_sta_frame_cb(uint8_t * buf, int len); void wfx_lwip_set_sta_link_up(void); void wfx_lwip_set_sta_link_down(void); -void wfx_lwip_start(void); +void sl_matter_lwip_start(void); struct netif * wfx_get_netif(sl_wfx_interface_t interface); -bool wfx_hw_ready(void); #if CHIP_DEVICE_CONFIG_ENABLE_IPV4 void wfx_dhcp_got_ipv4(uint32_t); void wfx_ip_changed_notify(int got_ip); @@ -355,6 +251,8 @@ int32_t wfx_rsi_send_data(void * p, uint16_t len); #endif //!(EXP_BOARD) #endif // RS911X_WIFI +bool wfx_hw_ready(void); + #ifdef RS911X_WIFI // for RS9116, 917 NCP and 917 SoC /* RSI Power Save */ #if SL_ICD_ENABLED @@ -366,21 +264,49 @@ sl_status_t wfx_power_save(); #endif /* SL_ICD_ENABLED */ #endif /* RS911X_WIFI */ -#ifdef WF200_WIFI -bool wfx_is_sta_provisioned(void); -sl_wfx_state_t wfx_get_wifi_state(void); -void wfx_bus_start(void); -sl_status_t get_all_counters(void); -void sl_wfx_host_gpio_init(void); -sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); -#endif /* WF200_WIFI */ +void sl_matter_wifi_task(void * arg); + +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 +void wfx_ip_changed_notify(int got_ip); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + +int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap); +int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); +int32_t wfx_rsi_reset_count(); +int32_t sl_wifi_platform_disconnect(); + +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#if SLI_SI917 +int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state); +#else +int32_t wfx_rsi_power_save(); +#endif /* SLI_SI917 */ +#endif /* SL_ICD_ENABLED */ + +/** + * @brief Posts an event to the Wi-Fi task + * + * @param[in] event Event to process. + */ +void sl_matter_wifi_post_event(WifiEvent event); + +#ifdef __cplusplus +extern "C" { +#endif #if (SLI_SI91X_MCU_INTERFACE) #if SL_ICD_ENABLED +// TODO : This should be moved outside of the Wifi interface functions void sl_button_on_change(uint8_t btn, uint8_t btnAction); #endif /* SL_ICD_ENABLED */ #endif /* SLI_SI91X_MCU_INTERFACE */ +#ifdef WF200_WIFI +void sl_wfx_host_gpio_init(void); +void wfx_bus_start(void); +sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); +#endif /* WF200_WIFI */ + #ifdef __cplusplus } #endif diff --git a/src/platform/silabs/wifi_args.gni b/src/platform/silabs/wifi/args.gni similarity index 91% rename from src/platform/silabs/wifi_args.gni rename to src/platform/silabs/wifi/args.gni index 5d523bd3a6..7b4da179da 100644 --- a/src/platform/silabs/wifi_args.gni +++ b/src/platform/silabs/wifi/args.gni @@ -21,9 +21,9 @@ import("${chip_root}/examples/platform/silabs/args.gni") import("${chip_root}/src/crypto/crypto.gni") # ARM architecture flags will be set based on silabs_family. -arm_platform_config = "${efr32_sdk_build_root}/silabs_arm.gni" +arm_platform_config = "${silabs_sdk_build_root}/silabs_arm.gni" -mbedtls_target = "${efr32_sdk_build_root}:efr32_sdk" +mbedtls_target = "${silabs_sdk_build_root}:silabs_sdk" # default to platform crypto implementation but allow commandline override if (chip_crypto == "") { @@ -35,7 +35,7 @@ if (chip_crypto == "") { chip_use_transitional_commissionable_data_provider = false # Use GSDK lwip instead of CHIP -lwip_root = "${efr32_sdk_build_root}/silabs_lwip" +lwip_root = "${silabs_sdk_build_root}/silabs_lwip" #lwip_platform = "external" lwip_platform = "silabs" diff --git a/src/platform/silabs/wifi/dhcp_client.cpp b/src/platform/silabs/wifi/lwip-support/dhcp_client.cpp similarity index 97% rename from src/platform/silabs/wifi/dhcp_client.cpp rename to src/platform/silabs/wifi/lwip-support/dhcp_client.cpp index c8b47a9f2b..a16064eb1d 100644 --- a/src/platform/silabs/wifi/dhcp_client.cpp +++ b/src/platform/silabs/wifi/lwip-support/dhcp_client.cpp @@ -23,11 +23,7 @@ #include "dhcp_client.h" #include "lwip/dhcp.h" -#include "wfx_host_events.h" -#include "wifi_config.h" - -#include "FreeRTOS.h" -#include "event_groups.h" +#include #include diff --git a/src/platform/silabs/wifi/dhcp_client.h b/src/platform/silabs/wifi/lwip-support/dhcp_client.h similarity index 100% rename from src/platform/silabs/wifi/dhcp_client.h rename to src/platform/silabs/wifi/lwip-support/dhcp_client.h diff --git a/src/platform/silabs/efr32/wifi/ethernetif.cpp b/src/platform/silabs/wifi/lwip-support/ethernetif.cpp similarity index 98% rename from src/platform/silabs/efr32/wifi/ethernetif.cpp rename to src/platform/silabs/wifi/lwip-support/ethernetif.cpp index d0f0ec6daf..7e880f62e9 100644 --- a/src/platform/silabs/efr32/wifi/ethernetif.cpp +++ b/src/platform/silabs/wifi/lwip-support/ethernetif.cpp @@ -21,12 +21,6 @@ #include #include -#include "em_bus.h" -#include "em_cmu.h" -#include "em_gpio.h" -#include "em_ldma.h" -#include "em_usart.h" - #ifndef WF200_WIFI #include "FreeRTOS.h" #include "event_groups.h" @@ -50,8 +44,7 @@ extern "C" { #endif // (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #endif // WF200_WIFI -#include "wfx_host_events.h" -#include "wifi_config.h" +#include #ifdef WF200_WIFI #include "sl_wfx.h" #endif @@ -163,7 +156,7 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len) /* We allocate a pbuf chain of pbufs from the Lwip buffer pool * and copy the data to the pbuf chain */ - if ((p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL)) != STRUCT_PBUF) + if ((p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL)) != NULL) { for (q = p, bufferoffset = 0; q != NULL; q = q->next) { @@ -269,7 +262,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) /* send the generated frame over Wifi network */ while ((result != SL_STATUS_OK) && (i++ < 10)) { - result = sl_wfx_send_ethernet_frame(tx_buffer, framelength, SL_WFX_STA_INTERFACE, PRIORITY_0); + result = sl_wfx_send_ethernet_frame(tx_buffer, framelength, SL_WFX_STA_INTERFACE, 0 /* priority */); } sl_wfx_host_free_buffer(tx_buffer, SL_WFX_TX_FRAME_BUFFER); diff --git a/src/platform/silabs/efr32/wifi/ethernetif.h b/src/platform/silabs/wifi/lwip-support/ethernetif.h similarity index 94% rename from src/platform/silabs/efr32/wifi/ethernetif.h rename to src/platform/silabs/wifi/lwip-support/ethernetif.h index dfea1ea6ad..56e564d30b 100644 --- a/src/platform/silabs/efr32/wifi/ethernetif.h +++ b/src/platform/silabs/wifi/lwip-support/ethernetif.h @@ -19,9 +19,16 @@ #include "lwip/err.h" #include "lwip/netif.h" + +#ifdef WF200_WIFI +#include "sl_wfx_api.h" +#include "sl_wfx_constants.h" +#endif // WF200_WIFI + #ifdef __cplusplus extern "C" { #endif + /*************************************************************************** * @fn err_t sta_ethernetif_init(struct netif *netif) * @brief @@ -47,6 +54,7 @@ void sl_wfx_host_received_frame_callback(sl_wfx_received_ind_t * rx_buffer); #else void wfx_host_received_sta_frame_cb(uint8_t * buf, int len); #endif /* WF200_WIFI */ + #ifdef __cplusplus } #endif diff --git a/src/platform/silabs/SiWx917/wifi/lwip_netif.cpp b/src/platform/silabs/wifi/lwip-support/lwip_netif.cpp similarity index 94% rename from src/platform/silabs/SiWx917/wifi/lwip_netif.cpp rename to src/platform/silabs/wifi/lwip-support/lwip_netif.cpp index d4bcbe4739..3b8dea41cc 100644 --- a/src/platform/silabs/SiWx917/wifi/lwip_netif.cpp +++ b/src/platform/silabs/wifi/lwip-support/lwip_netif.cpp @@ -19,25 +19,26 @@ #include #include -#include "wfx_host_events.h" -#include "wifi_config.h" +#include #include "dhcp_client.h" #include "ethernetif.h" -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" +#include -#include using namespace ::chip; using namespace ::chip::DeviceLayer; + static struct netif sta_netif; #ifdef SL_WFX_CONFIG_SOFTAP static struct netif ap_netif; #endif +#define LINK_UP (1) +#define LINK_DOWN (0) +#define MAC_48_BIT_SET (1) + /**************************************************************************** * @fn static void netif_config(struct netif *sta_if, struct netif *ap_if) * @brief @@ -114,13 +115,13 @@ void wfx_lwip_set_sta_link_down(void) } /*************************************************************************** - * @fn void wfx_lwip_start(void) + * @fn void sl_matter_lwip_start(void) * @brief * Initialize the LwIP stack * @param[in] None * @return None *****************************************************************************/ -void wfx_lwip_start(void) +void sl_matter_lwip_start(void) { /* Initialize the LwIP stack */ netif_config(&sta_netif, NULL); diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.cpp b/src/platform/silabs/wifi/rs911x/WifiInterface.cpp similarity index 81% rename from examples/platform/silabs/efr32/rs911x/rsi_if.cpp rename to src/platform/silabs/wifi/rs911x/WifiInterface.cpp index 78d13498ef..c918b3af36 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.cpp +++ b/src/platform/silabs/wifi/rs911x/WifiInterface.cpp @@ -15,24 +15,20 @@ * limitations under the License. */ -#include -#include -#include - -#include "em_bus.h" -#include "em_cmu.h" -#include "em_gpio.h" -#include "em_ldma.h" -#include "em_usart.h" - +#include "lwip/nd6.h" +#include "silabs_utils.h" #include "sl_status.h" #include -// TODO Fix include order issue #33120 -#include "wfx_host_events.h" +#include +#include +#include +#include +#include +#include +#include +#include -#ifdef __cplusplus extern "C" { -#endif #include "rsi_bootup_config.h" #include "rsi_common_apis.h" #include "rsi_data_types.h" @@ -45,21 +41,22 @@ extern "C" { #include "rsi_wlan_apis.h" #include "rsi_wlan_config.h" #include "rsi_wlan_non_rom.h" -#ifdef __cplusplus } -#endif -#include "dhcp_client.h" -#include "lwip/nd6.h" -#include "silabs_utils.h" -#include "wfx_rsi.h" - -#include -#include -#include -#include +using WifiStateFlags = chip::BitFlags; #define WFX_QUEUE_SIZE 10 +#define WFX_RSI_BUF_SZ (1024 * 10) +#define RSI_RESPONSE_MAX_SIZE (28) +#define RSI_RESPONSE_HOLD_BUFF_SIZE (128) +#define RSI_DRIVER_STATUS (0) +#define OPER_MODE_0 (0) +#define COEX_MODE_0 (0) +#define RESP_BUFF_SIZE (6) +#define AP_CHANNEL_NO_0 (0) +#define SCAN_BITMAP_OPTN_1 (1) + +WfxRsi_t wfx_rsi; static osThreadId_t sDrvThread; constexpr uint32_t kDrvTaskSize = 1792; @@ -107,9 +104,8 @@ static void rsi_wireless_driver_task_wrapper(void * argument) static void DHCPTimerEventHandler(void * arg) { - WfxEvent_t event; - event.eventType = WFX_EVT_DHCP_POLL; - WfxPostEvent(&event); + WifiEvent event = WifiEvent::kStationDhcpPoll; + sl_matter_wifi_post_event(event); } static void CancelDHCPTimer(void) @@ -226,14 +222,14 @@ int32_t wfx_rsi_reset_count(void) } /****************************************************************** - * @fn wfx_rsi_disconnect(void) + * @fn sl_wifi_platform_disconnect(void) * @brief * Getting the driver disconnect status * @param[in] None * @return * status *********************************************************************/ -int32_t wfx_rsi_disconnect(void) +int32_t sl_wifi_platform_disconnect(void) { return rsi_wlan_disconnect(); } @@ -283,8 +279,7 @@ int32_t wfx_rsi_power_save(void) *********************************************************************/ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t len) { - WfxEvent_t WfxEvent; - wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING; + wfx_rsi.dev_state.Clear(WifiState::kStationConnecting); if (status != RSI_SUCCESS) { /* @@ -300,8 +295,8 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t */ ChipLogProgress(DeviceLayer, "wfx_rsi_join_cb: success"); memset(&temp_reset, 0, sizeof(wfx_wifi_scan_ext_t)); - WfxEvent.eventType = WFX_EVT_STA_CONN; - WfxPostEvent(&WfxEvent); + WifiEvent event = WifiEvent::kStationConnect; + sl_matter_wifi_post_event(event); wfx_rsi.join_retries = 0; } @@ -318,11 +313,12 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t static void wfx_rsi_join_fail_cb(uint16_t status, uint8_t * buf, uint32_t len) { ChipLogError(DeviceLayer, "wfx_rsi_join_fail_cb: status: %d", status); - WfxEvent_t WfxEvent; wfx_rsi.join_retries += 1; - wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); - WfxEvent.eventType = WFX_EVT_STA_START_JOIN; - WfxPostEvent(&WfxEvent); + + wfx_rsi.dev_state.Clear(WifiState::kStationConnecting).Clear(WifiState::kStationConnected); + + WifiEvent event = WifiEvent::kStationStartJoin; + sl_matter_wifi_post_event(event); } /************************************************************************************* * @fn wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t *buf, uint32_t len) @@ -344,31 +340,30 @@ static void wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t * buf, uint32_t len) } /************************************************************************************* - * @fn static int32_t wfx_rsi_init(void) + * @fn static int32_t sl_matter_wifi_init(void) * @brief * driver initialization * @param[in] None * @return * None *****************************************************************************************/ -static int32_t wfx_rsi_init(void) +static int32_t sl_matter_wifi_init(void) { int32_t status; uint8_t buf[RSI_RESPONSE_HOLD_BUFF_SIZE]; extern void rsi_hal_board_init(void); - ChipLogProgress(DeviceLayer, "wfx_rsi_init: starting(HEAP_SZ = %d)", SL_HEAP_SIZE); //! Driver initialization status = rsi_driver_init(wfx_rsi_drv_buf, WFX_RSI_BUF_SZ); if ((status < RSI_DRIVER_STATUS) || (status > WFX_RSI_BUF_SZ)) { - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_driver_init failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_driver_init failed: %ld", status); return status; } /* ! Redpine module intialisation */ if ((status = rsi_device_init(LOAD_NWP_FW)) != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_device_init failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_device_init failed: %ld", status); return status; } /* @@ -377,7 +372,7 @@ static int32_t wfx_rsi_init(void) sDrvThread = osThreadNew(rsi_wireless_driver_task_wrapper, NULL, &kDrvTaskAttr); if (NULL == sDrvThread) { - ChipLogError(DeviceLayer, "wfx_rsi_init: failed to create task"); + ChipLogError(DeviceLayer, "failed to create task"); return RSI_ERROR_INVALID_PARAM; } @@ -388,7 +383,7 @@ static int32_t wfx_rsi_init(void) if ((status = rsi_wireless_init(OPER_MODE_0, COEX_MODE_0)) != RSI_SUCCESS) { #endif - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_wireless_init failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_wireless_init failed: %ld", status); return status; } @@ -397,7 +392,7 @@ static int32_t wfx_rsi_init(void) */ if (rsi_wlan_get(RSI_FW_VERSION, buf, sizeof(buf)) != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_wlan_get(RSI_FW_VERSION) failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_wlan_get(RSI_FW_VERSION) failed: %ld", status); return status; } @@ -415,16 +410,15 @@ static int32_t wfx_rsi_init(void) (void) rsi_wlan_radio_init(); /* Required so we can get MAC address */ if ((status = rsi_wlan_get(RSI_MAC_ADDRESS, &wfx_rsi.sta_mac.octet[0], RESP_BUFF_SIZE)) != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_wlan_get(RSI_MAC_ADDRESS) failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_wlan_get(RSI_MAC_ADDRESS) failed: %ld", status); return status; } - ChipLogDetail(DeviceLayer, "wfx_rsi_init: MAC: %02x:%02x:%02x %02x:%02x:%02x", wfx_rsi.sta_mac.octet[0], - wfx_rsi.sta_mac.octet[1], wfx_rsi.sta_mac.octet[2], wfx_rsi.sta_mac.octet[3], wfx_rsi.sta_mac.octet[4], - wfx_rsi.sta_mac.octet[5]); + ChipLogDetail(DeviceLayer, "MAC: %02x:%02x:%02x %02x:%02x:%02x", wfx_rsi.sta_mac.octet[0], wfx_rsi.sta_mac.octet[1], + wfx_rsi.sta_mac.octet[2], wfx_rsi.sta_mac.octet[3], wfx_rsi.sta_mac.octet[4], wfx_rsi.sta_mac.octet[5]); // Create the message queue - sWifiEventQueue = osMessageQueueNew(WFX_QUEUE_SIZE, sizeof(WfxEvent_t), NULL); + sWifiEventQueue = osMessageQueueNew(WFX_QUEUE_SIZE, sizeof(WifiEvent), NULL); if (sWifiEventQueue == NULL) { return SL_STATUS_ALLOCATION_FAILED; @@ -443,12 +437,12 @@ static int32_t wfx_rsi_init(void) */ if ((status = rsi_wlan_register_callbacks(RSI_JOIN_FAIL_CB, wfx_rsi_join_fail_cb)) != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_wlan_register_callbacks failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_wlan_register_callbacks failed: %ld", status); return status; } if ((status = rsi_wlan_register_callbacks(RSI_WLAN_DATA_RECEIVE_NOTIFY_CB, wfx_rsi_wlan_pkt_cb)) != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_init: rsi_wlan_register_callbacks failed: %ld", status); + ChipLogError(DeviceLayer, "rsi_wlan_register_callbacks failed: %ld", status); return status; } @@ -456,8 +450,7 @@ static int32_t wfx_rsi_init(void) rsi_semaphore_post(&sl_rs_ble_init_sem); #endif - wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY; - ChipLogProgress(DeviceLayer, "wfx_rsi_init: success"); + wfx_rsi.dev_state.Set(WifiState::kStationInit); return RSI_SUCCESS; } @@ -530,22 +523,18 @@ static void wfx_rsi_save_ap_info(void) // translation } /******************************************************************************************** - * @fn static void wfx_rsi_do_join(void) + * @fn static void sl_wifi_platform_join_network(void) * @brief * Start an async Join command * @return * None **********************************************************************************************/ -static void wfx_rsi_do_join(void) +static void sl_wifi_platform_join_network(void) { - int32_t status; + sl_status_t status = SL_STATUS_OK; rsi_security_mode_t connect_security_mode; - if (wfx_rsi.dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED)) - { - ChipLogProgress(DeviceLayer, "wfx_rsi_do_join: already in progress"); - return; - } + VerifyOrReturn(!wfx_rsi.dev_state.HasAny(WifiState::kStationConnecting, WifiState::kStationConnected)); switch (wfx_rsi.sec.security) { @@ -566,11 +555,12 @@ static void wfx_rsi_do_join(void) connect_security_mode = RSI_OPEN; break; default: - ChipLogError(DeviceLayer, "wfx_rsi_do_join: error: unknown security type."); + ChipLogError(DeviceLayer, "sl_wifi_platform_join_network: error: unknown security type."); return; } - ChipLogProgress(DeviceLayer, "wfx_rsi_do_join: connecting to %s, sec=%d", &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security); + ChipLogProgress(DeviceLayer, "sl_wifi_platform_join_network: connecting to %s, sec=%d", &wfx_rsi.sec.ssid[0], + wfx_rsi.sec.security); /* * Join the network @@ -578,11 +568,11 @@ static void wfx_rsi_do_join(void) /* TODO - make the WFX_SECURITY_xxx - same as RSI_xxx * Right now it's done by hand - we need something better */ - wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTING; + wfx_rsi.dev_state.Set(WifiState::kStationConnecting); if ((status = rsi_wlan_register_callbacks(RSI_JOIN_FAIL_CB, wfx_rsi_join_fail_cb)) != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_do_join: rsi_wlan_register_callbacks failed: %ld", status); + ChipLogError(DeviceLayer, "sl_wifi_platform_join_network: rsi_wlan_register_callbacks failed: %ld", status); } /* Try to connect Wifi with given Credentials @@ -591,8 +581,9 @@ static void wfx_rsi_do_join(void) if ((status = rsi_wlan_connect_async((int8_t *) &wfx_rsi.sec.ssid[0], connect_security_mode, &wfx_rsi.sec.passkey[0], wfx_rsi_join_cb)) != RSI_SUCCESS) { - wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING; - ChipLogProgress(DeviceLayer, "wfx_rsi_do_join: rsi_wlan_connect_async failed: %ld on try %d", status, wfx_rsi.join_retries); + wfx_rsi.dev_state.Clear(WifiState::kStationConnecting); + ChipLogProgress(DeviceLayer, "sl_wifi_platform_join_network: rsi_wlan_connect_async failed: %ld on try %d", status, + wfx_rsi.join_retries); wfx_retry_connection(++wfx_rsi.join_retries); } } @@ -613,7 +604,6 @@ void NotifyConnectivity(void) void HandleDHCPPolling(void) { struct netif * sta_netif; - WfxEvent_t event; sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE); if (sta_netif == NULL) @@ -644,19 +634,19 @@ void HandleDHCPPolling(void) { wfx_ipv6_notify(GET_IPV6_SUCCESS); hasNotifiedIPV6 = true; - event.eventType = WFX_EVT_STA_DHCP_DONE; - WfxPostEvent(&event); + WifiEvent event = WifiEvent::kStationDhcpDone; + sl_matter_wifi_post_event(event); NotifyConnectivity(); } } /** ResetDHCPNotificationFlags * @brief Reset the flags that are used to notify the application about DHCP connectivity - * and emits a WFX_EVT_STA_DO_DHCP event to trigger DHCP polling checks. Helper function for ProcessEvent. + * and emits a WifiEvent::kStationDoDhcp event to trigger DHCP polling checks. Helper function for ProcessEvent. */ void ResetDHCPNotificationFlags(void) { - WfxEvent_t outEvent; + WifiEvent outEvent; #if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) hasNotifiedIPV4 = false; @@ -664,20 +654,17 @@ void ResetDHCPNotificationFlags(void) hasNotifiedIPV6 = false; hasNotifiedWifiConnectivity = false; - outEvent.eventType = WFX_EVT_STA_DO_DHCP; - WfxPostEvent(&outEvent); + outEvent = WifiEvent::kStationDoDhcp; + sl_matter_wifi_post_event(outEvent); } -/** - * @brief Post the WfxEvent to tue WiFiEventQueue to be process by the wfx_rsi_task - */ -void WfxPostEvent(WfxEvent_t * event) +void sl_matter_wifi_post_event(WifiEvent event) { - sl_status_t status = osMessageQueuePut(sWifiEventQueue, event, 0, 0); + sl_status_t status = osMessageQueuePut(sWifiEventQueue, &event, 0, 0); if (status != osOK) { - ChipLogError(DeviceLayer, "WfxPostEvent: failed to post event with status: %ld", status); + ChipLogError(DeviceLayer, "sl_matter_wifi_post_event: failed to post event with status: %ld", status); // TODO: Handle error, requeue event depending on queue size or notify relevant task, // Chipdie, etc. } @@ -689,16 +676,16 @@ void WfxPostEvent(WfxEvent_t * event) * This function is responsible for processing different types of Wi-Fi events and taking appropriate actions based on the event * type. * - * @param inEvent The input Wi-Fi event to be processed. + * @param event The input Wi-Fi event to be processed. */ -void ProcessEvent(WfxEvent_t inEvent) +void ProcessEvent(WifiEvent event) { // Process event - switch (inEvent.eventType) + switch (event) { - case WFX_EVT_STA_CONN: { - ChipLogDetail(DeviceLayer, "_onWFXEvent: WFX_EVT_STA_CONN"); - wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED; + case WifiEvent::kStationConnect: { + ChipLogDetail(DeviceLayer, "WifiEvent::kStationConnect"); + wfx_rsi.dev_state.Set(WifiState::kStationConnected); ResetDHCPNotificationFlags(); wfx_lwip_set_sta_link_up(); /* We need to get AP Mac - TODO */ @@ -708,11 +695,12 @@ void ProcessEvent(WfxEvent_t inEvent) // is independant of IP connectivity. } break; - case WFX_EVT_STA_DISCONN: { - ChipLogDetail(DeviceLayer, "_onWFXEvent: WFX_EVT_STA_DISCONN"); + case WifiEvent::kStationDisconnect: { + ChipLogDetail(DeviceLayer, "WifiEvent::kStationDisconnect"); // TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something - wfx_rsi.dev_state &= - ~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE); + WifiStateFlags flagsToClear = WifiStateFlags(WifiState::kStationReady, WifiState::kStationConnecting, + WifiState::kStationConnected, WifiState::kStationDhcpDone); + wfx_rsi.dev_state.Clear(flagsToClear); /* TODO: Implement disconnect notify */ ResetDHCPNotificationFlags(); wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) -> @@ -723,13 +711,10 @@ void ProcessEvent(WfxEvent_t inEvent) wfx_ipv6_notify(GET_IPV6_FAIL); } break; - case WFX_EVT_AP_START: + case WifiEvent::kAPStart: // TODO: Currently unimplemented break; - case WFX_EVT_AP_STOP: - // TODO: Currently unimplemented - break; - case WFX_EVT_SCAN: { + case WifiEvent::kScan: { #ifdef SL_WFX_CONFIG_SCAN rsi_rsp_scan_t scan_rsp = { 0 }; memset(&scan_rsp, 0, sizeof(scan_rsp)); @@ -760,7 +745,7 @@ void ProcessEvent(WfxEvent_t inEvent) chip::Platform::CopyString(ap.ssid, ap.ssid_length, reinterpret_cast(scan->ssid)); // check if the scanned ssid is the one we are looking for - if (wfx_rsi.scan_ssid_length != 0 && strncmp(wfx_rsi.scan_ssid, ap.ssid, WFX_MAX_SSID_LENGTH) != CMP_SUCCESS) + if (wfx_rsi.scan_ssid_length != 0 && strncmp(wfx_rsi.scan_ssid, ap.ssid, WFX_MAX_SSID_LENGTH) != 0) { continue; // we found the targeted ssid. } @@ -794,22 +779,22 @@ void ProcessEvent(WfxEvent_t inEvent) #endif /* SL_WFX_CONFIG_SCAN */ } break; - case WFX_EVT_STA_START_JOIN: { + case WifiEvent::kStationStartJoin: { // saving the AP related info wfx_rsi_save_ap_info(); // Joining to the network - wfx_rsi_do_join(); + sl_wifi_platform_join_network(); } break; - case WFX_EVT_STA_DO_DHCP: { + case WifiEvent::kStationDoDhcp: { StartDHCPTimer(WFX_RSI_DHCP_POLL_INTERVAL); } break; - case WFX_EVT_STA_DHCP_DONE: { + case WifiEvent::kStationDhcpDone: { CancelDHCPTimer(); } break; - case WFX_EVT_DHCP_POLL: { + case WifiEvent::kStationDhcpPoll: { HandleDHCPPolling(); } break; @@ -819,7 +804,7 @@ void ProcessEvent(WfxEvent_t inEvent) } /********************************************************************************* - * @fn void wfx_rsi_task(void *arg) + * @fn void sl_matter_wifi_task(void *arg) * @brief * The main WLAN task - started by wfx_wifi_start () that interfaces with RSI. * The rest of RSI stuff come in call-backs. @@ -829,30 +814,30 @@ void ProcessEvent(WfxEvent_t inEvent) * None **********************************************************************************/ /* ARGSUSED */ -void wfx_rsi_task(void * arg) +void sl_matter_wifi_task(void * arg) { (void) arg; - uint32_t rsi_status = wfx_rsi_init(); + uint32_t rsi_status = sl_matter_wifi_init(); if (rsi_status != RSI_SUCCESS) { - ChipLogError(DeviceLayer, "wfx_rsi_task: wfx_rsi_init failed: %ld", rsi_status); + ChipLogError(DeviceLayer, "sl_matter_wifi_task: sl_matter_wifi_init failed: %ld", rsi_status); return; } - WfxEvent_t wfxEvent; - wfx_lwip_start(); - wfx_started_notify(); + WifiEvent event; + sl_matter_lwip_start(); + sl_matter_wifi_task_started(); - ChipLogProgress(DeviceLayer, "wfx_rsi_task: starting event loop"); + ChipLogProgress(DeviceLayer, "sl_matter_wifi_task: starting event loop"); for (;;) { - osStatus_t status = osMessageQueueGet(sWifiEventQueue, &wfxEvent, NULL, osWaitForever); + osStatus_t status = osMessageQueueGet(sWifiEventQueue, &event, NULL, osWaitForever); if (status == osOK) { - ProcessEvent(wfxEvent); + ProcessEvent(event); } else { - ChipLogProgress(DeviceLayer, "wfx_rsi_task: get event failed: %x", status); + ChipLogProgress(DeviceLayer, "sl_matter_wifi_task: get event failed: %x", status); } } } @@ -871,16 +856,15 @@ void wfx_dhcp_got_ipv4(uint32_t ip) /* * Acquire the new IP address */ - wfx_rsi.ip4_addr[0] = (ip) &HEX_VALUE_FF; - wfx_rsi.ip4_addr[1] = (ip >> 8) & HEX_VALUE_FF; - wfx_rsi.ip4_addr[2] = (ip >> 16) & HEX_VALUE_FF; - wfx_rsi.ip4_addr[3] = (ip >> 24) & HEX_VALUE_FF; + wfx_rsi.ip4_addr[0] = (ip) &0xFF; + wfx_rsi.ip4_addr[1] = (ip >> 8) & 0xFF; + wfx_rsi.ip4_addr[2] = (ip >> 16) & 0xFF; + wfx_rsi.ip4_addr[3] = (ip >> 24) & 0xFF; ChipLogProgress(DeviceLayer, "DHCP OK: IP=%d.%d.%d.%d", wfx_rsi.ip4_addr[0], wfx_rsi.ip4_addr[1], wfx_rsi.ip4_addr[2], wfx_rsi.ip4_addr[3]); /* Notify the Connectivity Manager - via the app */ - wfx_rsi.dev_state |= WFX_RSI_ST_STA_DHCP_DONE; + wfx_rsi.dev_state.Set(WifiState::kStationDhcpDone, WifiState::kStationReady); wfx_ip_changed_notify(IP_STATUS_SUCCESS); - wfx_rsi.dev_state |= WFX_RSI_ST_STA_READY; } #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ @@ -971,4 +955,17 @@ int32_t wfx_rsi_send_data(void * p, uint16_t len) return status; } -WfxRsi_t wfx_rsi; +#if SL_ICD_ENABLED +/********************************************************************* + * @fn sl_status_t wfx_power_save(void) + * @brief + * Implements the power save in sleepy application + * @param[in] None + * @return SL_STATUS_OK if successful, + * SL_STATUS_FAIL otherwise + ***********************************************************************/ +sl_status_t wfx_power_save(void) // TODO : Figure out why the extern C is necessary +{ + return (wfx_rsi_power_save() ? SL_STATUS_FAIL : SL_STATUS_OK); +} +#endif /* SL_ICD_ENABLED */ diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c b/src/platform/silabs/wifi/rs911x/platform/efx32_ncp_host.c similarity index 96% rename from examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c rename to src/platform/silabs/wifi/rs911x/platform/efx32_ncp_host.c index 0a2fad7d0d..c7173763d5 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c +++ b/src/platform/silabs/wifi/rs911x/platform/efx32_ncp_host.c @@ -26,9 +26,11 @@ #include "sl_constants.h" #include "sl_rsi_utility.h" #include "sl_si91x_host_interface.h" +#include "sl_si91x_ncp_utility.h" #include "sl_si91x_status.h" #include "sl_status.h" #include "sl_wifi_constants.h" +#include #include #include @@ -40,9 +42,6 @@ #include "sl_board_control.h" #endif // SL_BOARD_NAME -#include "sl_si91x_ncp_utility.h" -#include "spi_multiplex.h" - static bool dma_callback(unsigned int channel, unsigned int sequenceNo, void * userParam); uint32_t rx_ldma_channel; diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/src/platform/silabs/wifi/rs911x/platform/efx_spi.c similarity index 95% rename from examples/platform/silabs/efr32/rs911x/hal/efx_spi.c rename to src/platform/silabs/wifi/rs911x/platform/efx_spi.c index 1f10640e04..a339f711a4 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/src/platform/silabs/wifi/rs911x/platform/efx_spi.c @@ -18,33 +18,23 @@ /** * Includes */ -#include -#include -#include #include "FreeRTOS.h" -#include "event_groups.h" -#include "semphr.h" -#include "task.h" - -#include "dmadrv.h" -#include "em_chip.h" #include "em_cmu.h" -#include "em_core.h" -#include "em_device.h" -#include "em_gpio.h" -#include "em_ldma.h" +#include "em_eusart.h" #include "gpiointerrupt.h" +#include "rsi_board_configuration.h" +#include "rsi_driver.h" +#include "semphr.h" +#include "silabs_utils.h" #include "sl_device_init_clocks.h" #include "sl_device_init_hfxo.h" +#include "sl_spidrv_eusart_exp_config.h" #include "sl_spidrv_instances.h" #include "sl_status.h" #include "spidrv.h" - -#include "silabs_utils.h" -#include "spi_multiplex.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" +#include "task.h" +#include #ifdef SL_BOARD_NAME #include "sl_board_control.h" @@ -54,9 +44,6 @@ #include "sl_power_manager.h" #endif -#include "rsi_board_configuration.h" -#include "rsi_driver.h" - #if SL_BTLCTRL_MUX #include "btl_interface.h" #endif // SL_BTLCTRL_MUX @@ -68,13 +55,12 @@ #include "sl_mx25_flash_shutdown_usart_config.h" #endif // SL_MX25CTRL_MUX -#include "em_eusart.h" -#include "sl_spidrv_eusart_exp_config.h" -#include "spi_multiplex.h" - #define SL_SPIDRV_HANDLE sl_spidrv_eusart_exp_handle #define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED SL_SPIDRV_EUSART_EXP_BITRATE +#define MIN_XLEN (0) +#define WFX_SPI_NVIC_PRIORITY (5) + #define CONCAT(A, B) (A##B) #define SPI_CLOCK(N) CONCAT(cmuClock_USART, N) // Macro to drive semaphore block minimun timer in milli seconds @@ -111,16 +97,16 @@ void sl_wfx_host_gpio_init(void) CMU_ClockEnable(cmuClock_GPIO, true); // Set CS pin to high/inactive - GPIO_PinModeSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN, gpioModePushPull, PINOUT_SET); + GPIO_PinModeSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN, gpioModePushPull, 1); - GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, PINOUT_SET); - GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModePushPull, PINOUT_CLEAR); + GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, 1); + GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModePushPull, 0); CMU_OscillatorEnable(cmuOsc_LFXO, true, true); // Set up interrupt based callback function - trigger on both edges. GPIOINT_Init(); - GPIO_PinModeSet(WFX_INTERRUPT_PIN.port, WFX_INTERRUPT_PIN.pin, gpioModeInputPull, PINOUT_CLEAR); + GPIO_PinModeSet(WFX_INTERRUPT_PIN.port, WFX_INTERRUPT_PIN.pin, gpioModeInputPull, 0); GPIO_ExtIntConfig(WFX_INTERRUPT_PIN.port, WFX_INTERRUPT_PIN.pin, SL_WFX_HOST_PINOUT_SPI_IRQ, true, false, true); GPIOINT_CallbackRegister(SL_WFX_HOST_PINOUT_SPI_IRQ, rsi_gpio_irq_cb); GPIO_IntDisable(1 << SL_WFX_HOST_PINOUT_SPI_IRQ); /* Will be enabled by RSI */ @@ -205,7 +191,7 @@ sl_status_t sl_wfx_host_spi_cs_deassert(void) if (SL_STATUS_OK == status) { GPIO_PinOutSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); - GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; + GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = 0; spi_enabled = false; } } @@ -268,7 +254,7 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void) #endif // SL_SPICTRL_MUX return SL_STATUS_FAIL; } - GPIO->USARTROUTE[SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; + GPIO->USARTROUTE[SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO].ROUTEEN = 0; #if SL_MX25CTRL_MUX sl_wfx_host_spiflash_cs_deassert(); #endif // SL_MX25CTRL_MUX @@ -301,7 +287,7 @@ sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) { USART_Enable(SL_MEMLCD_SPI_PERIPHERAL, usartDisable); CMU_ClockEnable(SPI_CLOCK(SL_MEMLCD_SPI_PERIPHERAL_NO), false); - GPIO->USARTROUTE[SL_MEMLCD_SPI_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; + GPIO->USARTROUTE[SL_MEMLCD_SPI_PERIPHERAL_NO].ROUTEEN = 0; sl_status_t status = sl_board_disable_display(); #if SL_SPICTRL_MUX xSemaphoreGive(spi_sem_sync_hdl); diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_board_configuration.h b/src/platform/silabs/wifi/rs911x/platform/rsi_board_configuration.h similarity index 100% rename from examples/platform/silabs/efr32/rs911x/hal/rsi_board_configuration.h rename to src/platform/silabs/wifi/rs911x/platform/rsi_board_configuration.h diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal.h b/src/platform/silabs/wifi/rs911x/platform/rsi_hal.h similarity index 100% rename from examples/platform/silabs/efr32/rs911x/hal/rsi_hal.h rename to src/platform/silabs/wifi/rs911x/platform/rsi_hal.h diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_interrupt.c similarity index 98% rename from examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c rename to src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_interrupt.c index 1cb5ddf920..8bd277e624 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c +++ b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_interrupt.c @@ -35,9 +35,6 @@ #include "event_groups.h" #include "task.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" - #if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #include "sl_board_configuration.h" diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_ioports.c b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_ioports.c similarity index 92% rename from examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_ioports.c rename to src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_ioports.c index 6ea20caf48..ba517b417b 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_ioports.c +++ b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_ioports.c @@ -35,9 +35,6 @@ #include "event_groups.h" #include "task.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" - #include "rsi_board_configuration.h" #include "rsi_driver.h" /*===========================================================*/ @@ -64,17 +61,17 @@ void rsi_hal_config_gpio(uint8_t gpio_number, uint8_t mode, uint8_t value) { case RSI_HAL_SLEEP_CONFIRM_PIN: case RSI_HAL_LP_SLEEP_CONFIRM_PIN: - GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, PINOUT_SET); + GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1); break; case RSI_HAL_WAKEUP_INDICATION_PIN: #ifndef LOGGING_STATS - GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, PINOUT_CLEAR); + GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, 0); #else - GPIO_PinModeSet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, PINOUT_CLEAR); + GPIO_PinModeSet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, 0); #endif break; case RSI_HAL_RESET_PIN: - GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, PINOUT_SET); + GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, 1); break; default: break; @@ -96,17 +93,17 @@ void rsi_hal_set_gpio(uint8_t gpio_number) { case RSI_HAL_SLEEP_CONFIRM_PIN: case RSI_HAL_LP_SLEEP_CONFIRM_PIN: - GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, PINOUT_SET); + GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1); break; case RSI_HAL_WAKEUP_INDICATION_PIN: #ifndef LOGGING_STATS - GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeInput, PINOUT_SET); + GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeInput, 1); #else - GPIO_PinModeSet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin, gpioModeInput, PINOUT_SET); + GPIO_PinModeSet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin, gpioModeInput, 1); #endif break; case RSI_HAL_RESET_PIN: - GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModeWiredOrPullDown, PINOUT_SET); + GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModeWiredOrPullDown, 1); break; default: break; diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_rtc.c b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_rtc.c similarity index 100% rename from examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_rtc.c rename to src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_rtc.c diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_timer.c b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_timer.c similarity index 97% rename from examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_timer.c rename to src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_timer.c index 7a80072817..9c1b137748 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_timer.c +++ b/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_timer.c @@ -34,8 +34,6 @@ extern void SysTick_Handler(void); extern void xPortSysTickHandler(void); #endif /* SysTick */ #endif /* RSI_WITH_OS */ -#include "wfx_host_events.h" - /* RSI Driver include file */ #include "rsi_driver.h" /* RSI WLAN Config include file */ @@ -49,7 +47,10 @@ extern void xPortSysTickHandler(void); #include "rsi_wlan.h" #include "rsi_wlan_apis.h" #include "rsi_wlan_config.h" -#include "wfx_rsi.h" + +#define WFX_RSI_NUM_TIMERS (2) /* Number of RSI timers to alloc */ +#define CONVERT_SEC_TO_MSEC (1000) +#define CONVERT_USEC_TO_MSEC (1 / 1000) #ifndef _use_the_rsi_defined_functions @@ -134,7 +135,7 @@ int32_t rsi_timer_start(uint8_t timer_node, uint8_t mode, uint8_t type, uint32_t return RSI_ERROR_INSUFFICIENT_BUFFER; } - (void) xTimerStart(tp->handle, TIMER_TICKS_TO_WAIT_0); + (void) xTimerStart(tp->handle, pdMS_TO_TICKS(0)); return RSI_ERROR_NONE; } diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h b/src/platform/silabs/wifi/rs911x/platform/sl_board_configuration.h similarity index 100% rename from examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h rename to src/platform/silabs/wifi/rs911x/platform/sl_board_configuration.h diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration_SiWx917.h b/src/platform/silabs/wifi/rs911x/platform/sl_board_configuration_SiWx917.h similarity index 100% rename from examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration_SiWx917.h rename to src/platform/silabs/wifi/rs911x/platform/sl_board_configuration_SiWx917.h diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c b/src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.c similarity index 95% rename from examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c rename to src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.c index b16bbdc475..1d1ab1409c 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c +++ b/src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.c @@ -46,8 +46,6 @@ #include "silabs_utils.h" #include "sl_si91x_ncp_utility.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" #if SL_MX25CTRL_MUX sl_status_t sl_wfx_host_spiflash_cs_assert(void); @@ -221,7 +219,7 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void) #endif // SL_SPICTRL_MUX return SL_STATUS_FAIL; } - GPIO->USARTROUTE[SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; + GPIO->USARTROUTE[SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO].ROUTEEN = 0; #if SL_MX25CTRL_MUX sl_wfx_host_spiflash_cs_deassert(); #endif // SL_MX25CTRL_MUX diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h b/src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.h similarity index 84% rename from examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h rename to src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.h index 0bd8dae764..b434e35f82 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h +++ b/src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.h @@ -29,7 +29,9 @@ #include "semphr.h" #include "silabs_utils.h" #include "sl_status.h" -#include "spi_multiplex.h" + +// TODO: This is a WF200 specific include. It is not clear why we need this in the 917 NCP files. +#include #if defined(CHIP_9117) #include "em_usart.h" @@ -46,4 +48,4 @@ sl_status_t spi_board_init(void); extern uint32_t rx_ldma_channel; extern uint32_t tx_ldma_channel; -#endif // SL_SI91X_NCP_UTILITY_H \ No newline at end of file +#endif // SL_SI91X_NCP_UTILITY_H diff --git a/examples/platform/silabs/efr32/rs911x/rs9117.gni b/src/platform/silabs/wifi/rs911x/rs9117.gni similarity index 51% rename from examples/platform/silabs/efr32/rs911x/rs9117.gni rename to src/platform/silabs/wifi/rs911x/rs9117.gni index cff3e3da1f..cbeaf98698 100644 --- a/examples/platform/silabs/efr32/rs911x/rs9117.gni +++ b/src/platform/silabs/wifi/rs911x/rs9117.gni @@ -1,23 +1,38 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") rs911x_src_plat = [ - "${examples_plat_dir}/rs911x/sl_wifi_if.cpp", - "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c", - "${examples_plat_dir}/rs911x/hal/sl_si91x_ncp_utility.c", - "${examples_plat_dir}/rs911x/hal/efx32_ncp_host.c", - "${silabs_common_plat_dir}/wifi/wfx_notify.cpp", - "${silabs_common_plat_dir}/wifi/wfx_rsi_host.cpp", -] + "${chip_root}/src/platform/silabs/wifi/SiWx/WifiInterface.cpp", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_interrupt.c", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/sl_si91x_ncp_utility.c", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/sl_board_configuration.h", + "${chip_root}/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp", + "${chip_root}/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h", + + # TODO: We shouldn't need a file form the WF200 for the SiWx917 NCP builds + "${chip_root}/src/platform/silabs/wifi/wf200/platform/spi_multiplex.h", -rs9117_inc_plat = [ - "${examples_plat_dir}/rs911x", - "${examples_plat_dir}/rs911x/hal", - "${wifi_sdk_root}/components/si91x/ble/inc", + # TODO : We should be using the file from the Wiseconnect SDK and not our copy of it. + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/efx32_ncp_host.c", ] -rs911x_cflags = [ "-Wno-empty-body" ] +rs9117_inc_plat = [ "${wifi_sdk_root}/components/si91x/ble/inc" ] + rs9117_src_sapi = [ # sl_si91x_wireless component "${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_driver.c", @@ -30,6 +45,9 @@ rs9117_src_sapi = [ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ncp_interface/spi/sl_si91x_spi.c", "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ncp_interface/sl_si91x_ncp_driver.c", + # Wi-Fi Config - Using the file sdk support until the wiseconnect file is fixed + "${sdk_support_root}/components/service/network_manager/src/sl_net_for_lwip.c", + # wifi component "${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c", "${wifi_sdk_root}/components/protocol/wifi/si91x/sl_wifi.c", diff --git a/examples/platform/silabs/efr32/rs911x/rs911x.gni b/src/platform/silabs/wifi/rs911x/rs911x.gni similarity index 63% rename from examples/platform/silabs/efr32/rs911x/rs911x.gni rename to src/platform/silabs/wifi/rs911x/rs911x.gni index b25fbefc8e..3daba8b049 100644 --- a/examples/platform/silabs/efr32/rs911x/rs911x.gni +++ b/src/platform/silabs/wifi/rs911x/rs911x.gni @@ -1,15 +1,30 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") rs911x_src_plat = [ - "${examples_plat_dir}/rs911x/rsi_if.cpp", - "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c", - "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c", - "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c", - "${examples_plat_dir}/rs911x/hal/efx_spi.c", - "${silabs_common_plat_dir}/wifi/wfx_notify.cpp", - "${silabs_common_plat_dir}/wifi/wfx_rsi_host.cpp", + "${chip_root}/src/platform/silabs/wifi/rs911x/WifiInterface.cpp", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_interrupt.c", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_ioports.c", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/rsi_hal_mcu_timer.c", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/efx_spi.c", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/rsi_board_configuration.h", + "${chip_root}/src/platform/silabs/wifi/rs911x/platform/rsi_hal.h", + "${chip_root}/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp", ] # @@ -53,10 +68,4 @@ rs911x_src_sapi = [ "${wiseconnect_sdk_root}/sapi/network/socket/rsi_socket_rom.c", ] -rs911x_cflags = [ "-Wno-empty-body" ] - -rs911x_inc_plat = [ - "${examples_plat_dir}/rs911x", - "${examples_plat_dir}/rs911x/hal", - "${wiseconnect_sdk_root}/sapi/include", -] +rs911x_inc_plat = [ "${wiseconnect_sdk_root}/sapi/include" ] diff --git a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h b/src/platform/silabs/wifi/rs911x/rsi_wlan_config.h similarity index 100% rename from examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h rename to src/platform/silabs/wifi/rs911x/rsi_wlan_config.h diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/src/platform/silabs/wifi/wf200/WifiInterface.cpp similarity index 91% rename from examples/platform/silabs/efr32/wf200/host_if.cpp rename to src/platform/silabs/wifi/wf200/WifiInterface.cpp index 516abca22b..fef3cb3a63 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/src/platform/silabs/wifi/wf200/WifiInterface.cpp @@ -15,41 +15,37 @@ * limitations under the License. */ -/* Includes */ - -#include -#include -#include - +#include "FreeRTOS.h" #include "em_bus.h" #include "em_cmu.h" #include "em_gpio.h" #include "em_ldma.h" #include "em_usart.h" -#include "gpiointerrupt.h" - -#include "wifi_config.h" - -#include "AppConfig.h" -#include "sl_wfx_board.h" -#include "sl_wfx_host.h" -#include "sl_wfx_task.h" -#include "wfx_host_events.h" - -#include "FreeRTOS.h" #include "event_groups.h" +#include "gpiointerrupt.h" +#include "sl_wfx_cmd_api.h" +#include "sl_wfx_constants.h" #include "task.h" - -#include "dhcp_client.h" -#include "ethernetif.h" #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace ::chip; using namespace ::chip::DeviceLayer; +// TODO: This is a workaround because we depend on the platform lib which depends on the platform implementation. +// As such we can't depend on the platform here as well +extern void HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData); + /* wfxRsi Task will use as its stack */ StackType_t wfxEventTaskStack[1024] = { 0 }; @@ -70,9 +66,30 @@ static wfx_wifi_scan_result_t ap_info; #define PASSIVE_CHANNEL_TIME 0 #define NUM_PROBE_REQUEST 2 -// wfx_fmac_driver context -sl_wfx_context_t wifiContext; -static uint8_t wifi_extra; +/* Wi-Fi bitmask events - for the task */ +#define SL_WFX_CONNECT (1 << 1) +#define SL_WFX_DISCONNECT (1 << 2) +#define SL_WFX_START_AP (1 << 3) +#define SL_WFX_STOP_AP (1 << 4) +#define SL_WFX_SCAN_START (1 << 5) +#define SL_WFX_SCAN_COMPLETE (1 << 6) +#define SL_WFX_RETRY_CONNECT (1 << 7) + +#define WLAN_TASK_STACK_SIZE (1024) +#define ETH_FRAME (0) +#define AP_START_SUCCESS (0) +#define BITS_TO_WAIT (0) +#define BEACON_1 (0) +#define CHANNEL_LIST ((const uint8_t *) 0) +#define CHANNEL_COUNT (0) +#define IE_DATA ((const uint8_t *) 0) +#define IE_DATA_LENGTH (0) +#define BSSID_SCAN ((const uint8_t *) 0) +#define CHANNEL_0 (0) +#define PREVENT_ROAMING (1) +#define DISABLE_PMF_MODE (0) +#define STA_IP_FAIL (0) +#define WLAN_TASK_PRIORITY (1) /***************************************************************************** * macros @@ -92,8 +109,6 @@ uint8_t softap_channel = SOFTAP_CHANNEL_DEFAULT; /* station network interface structures */ struct netif * sta_netif; wfx_wifi_provision_t wifi_provision; -sl_wfx_get_counters_cnf_t * counters; -sl_wfx_get_counters_cnf_t * Tempcounters; #define PUT_COUNTER(name) ChipLogDetail(DeviceLayer, "%-24s %lu", #name, (unsigned long) counters->body.count_##name); bool hasNotifiedIPV6 = false; @@ -133,6 +148,162 @@ static void sl_wfx_ap_client_rejected_callback(uint32_t status, uint8_t * mac); extern uint32_t gOverrunCount; +namespace { + +// wfx_fmac_driver context +sl_wfx_context_t wifiContext; +uint8_t wifi_extra; + +typedef struct __attribute__((__packed__)) sl_wfx_get_counters_cnf_body_s +{ + uint32_t status; + uint16_t mib_id; + uint16_t length; + uint32_t rcpi; + uint32_t count_plcp_errors; + uint32_t count_fcs_errors; + uint32_t count_tx_packets; + uint32_t count_rx_packets; + uint32_t count_rx_packet_errors; + uint32_t count_rx_decryption_failures; + uint32_t count_rx_mic_failures; + uint32_t count_rx_no_key_failures; + uint32_t count_tx_multicast_frames; + uint32_t count_tx_frames_success; + uint32_t count_tx_frame_failures; + uint32_t count_tx_frames_retried; + uint32_t count_tx_frames_multi_retried; + uint32_t count_rx_frame_duplicates; + uint32_t count_rts_success; + uint32_t count_rts_failures; + uint32_t count_ack_failures; + uint32_t count_rx_multicast_frames; + uint32_t count_rx_frames_success; + uint32_t count_rx_cmacicv_errors; + uint32_t count_rx_cmac_replays; + uint32_t count_rx_mgmt_ccmp_replays; + uint32_t count_rx_bipmic_errors; + uint32_t count_rx_beacon; + uint32_t count_miss_beacon; + uint32_t reserved[15]; +} sl_wfx_get_counters_cnf_body_t; + +typedef struct __attribute__((__packed__)) sl_wfx_get_counters_cnf_s +{ + /** Common message header. */ + sl_wfx_header_t header; + /** Confirmation message body. */ + sl_wfx_get_counters_cnf_body_t body; +} sl_wfx_get_counters_cnf_t; + +typedef struct __attribute__((__packed__)) sl_wfx_mib_req_body_s +{ + uint16_t mib_id; ///< ID of the MIB to be read. + uint16_t reserved; +} sl_wfx_mib_req_body_t; + +typedef struct __attribute__((__packed__)) sl_wfx_header_mib_s +{ + uint16_t length; ///< Message length in bytes including this uint16_t. + ///< Maximum value is 8188 but maximum Request size is FW dependent and reported in the + ///< ::sl_wfx_startup_ind_body_t::size_inp_ch_buf. + uint8_t id; ///< Contains the message Id indexed by sl_wfx_general_commands_ids_t or sl_wfx_message_ids_t. + uint8_t reserved : 1; + uint8_t interface : 2; + uint8_t seqnum : 3; + uint8_t encrypted : 2; +} sl_wfx_header_mib_t; + +typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s +{ + /** Common message header. */ + sl_wfx_header_mib_t header; + /** Request message body. */ + sl_wfx_mib_req_body_t body; +} sl_wfx_mib_req_t; + +sl_wfx_get_counters_cnf_t * counters; + +/**************************************************************************** + * @brief + * get the wifi state + * @return returns wificonetext state + *****************************************************************************/ +sl_wfx_state_t wfx_get_wifi_state(void) +{ + return wifiContext.state; +} + +sl_status_t get_all_counters(void) +{ + sl_status_t result; + uint8_t command_id = 0x05; + uint16_t mib_id = 0x2035; + sl_wfx_mib_req_t * request = nullptr; + uint32_t request_length = SL_WFX_ROUND_UP_EVEN(sizeof(sl_wfx_header_mib_t) + sizeof(sl_wfx_mib_req_body_t)); + + result = + sl_wfx_allocate_command_buffer((sl_wfx_generic_message_t **) &request, command_id, SL_WFX_CONTROL_BUFFER, request_length); + + VerifyOrReturnError(request != nullptr, SL_STATUS_NULL_POINTER); + + request->body.mib_id = mib_id; + request->header.interface = 0x2; + request->header.encrypted = 0x0; + + result = sl_wfx_send_request(command_id, (sl_wfx_generic_message_t *) request, request_length); + SL_WFX_ERROR_CHECK(result); + + result = sl_wfx_host_wait_for_confirmation(command_id, SL_WFX_DEFAULT_REQUEST_TIMEOUT_MS, (void **) &counters); + SL_WFX_ERROR_CHECK(result); + + ChipLogDetail(DeviceLayer, "%-24s %12s ", "", "Debug Counters Content"); + ChipLogDetail(DeviceLayer, "%-24s %lu", "rcpi", (unsigned long) counters->body.rcpi); + PUT_COUNTER(plcp_errors); + PUT_COUNTER(fcs_errors); + PUT_COUNTER(tx_packets); + PUT_COUNTER(rx_packets); + PUT_COUNTER(rx_packet_errors); + PUT_COUNTER(rx_decryption_failures); + PUT_COUNTER(rx_mic_failures); + PUT_COUNTER(rx_no_key_failures); + PUT_COUNTER(tx_multicast_frames); + PUT_COUNTER(tx_frames_success); + PUT_COUNTER(tx_frame_failures); + PUT_COUNTER(tx_frames_retried); + PUT_COUNTER(tx_frames_multi_retried); + PUT_COUNTER(rx_frame_duplicates); + PUT_COUNTER(rts_success); + PUT_COUNTER(rts_failures); + PUT_COUNTER(ack_failures); + PUT_COUNTER(rx_multicast_frames); + PUT_COUNTER(rx_frames_success); + PUT_COUNTER(rx_cmacicv_errors); + PUT_COUNTER(rx_cmac_replays); + PUT_COUNTER(rx_mgmt_ccmp_replays); + PUT_COUNTER(rx_bipmic_errors); + PUT_COUNTER(rx_beacon); + PUT_COUNTER(miss_beacon); + +error_handler: + + if (result == SL_STATUS_TIMEOUT) + { + if (sl_wfx_context->used_buffers > 0) + { + sl_wfx_context->used_buffers--; + } + } + if (request != nullptr) + { + sl_wfx_free_command_buffer((sl_wfx_generic_message_t *) request, command_id, SL_WFX_CONTROL_BUFFER); + } + + return result; +} + +} // namespace + /*************************************************************************** * @brief * Creates WFX events processing task. @@ -164,7 +335,7 @@ sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload) /******** INDICATION ********/ case SL_WFX_STARTUP_IND_ID: { ChipLogProgress(DeviceLayer, "startup completed."); - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, event_payload); + HandleWFXSystemEvent(WIFI_EVENT, event_payload); break; } case SL_WFX_CONNECT_IND_ID: { @@ -280,7 +451,7 @@ static void sl_wfx_scan_result_callback(sl_wfx_scan_result_ind_body_t * scan_res /* don't save if filter only wants specific ssid */ if (scan_ssid != nullptr) { - if (strcmp(scan_ssid, (char *) &scan_result->ssid_def.ssid[0]) != CMP_SUCCESS) + if (strcmp(scan_ssid, (char *) &scan_result->ssid_def.ssid[0]) != 0) return; } if ((ap = (struct scan_result_holder *) (chip::Platform::MemoryAlloc(sizeof(*ap)))) == (struct scan_result_holder *) 0) @@ -715,8 +886,8 @@ static void wfx_wifi_hw_start(void) { /* Initialize the LwIP stack */ ChipLogDetail(DeviceLayer, "WF200:Start LWIP"); - wfx_lwip_start(); - wfx_started_notify(); + sl_matter_lwip_start(); + sl_matter_wifi_task_started(); wifiContext.state = SL_WFX_STARTED; /* Really this is a bit mask */ ChipLogDetail(DeviceLayer, "WF200:ready.."); } @@ -781,74 +952,6 @@ int32_t wfx_get_ap_ext(wfx_wifi_scan_ext_t * extra_info) return status; } -sl_status_t get_all_counters(void) -{ - sl_status_t result; - uint8_t command_id = 0x05; - uint16_t mib_id = 0x2035; - sl_wfx_mib_req_t * request = nullptr; - uint32_t request_length = SL_WFX_ROUND_UP_EVEN(sizeof(sl_wfx_header_mib_t) + sizeof(sl_wfx_mib_req_body_t)); - - result = - sl_wfx_allocate_command_buffer((sl_wfx_generic_message_t **) &request, command_id, SL_WFX_CONTROL_BUFFER, request_length); - - VerifyOrReturnError(request != nullptr, SL_STATUS_NULL_POINTER); - - request->body.mib_id = mib_id; - request->header.interface = 0x2; - request->header.encrypted = 0x0; - - result = sl_wfx_send_request(command_id, (sl_wfx_generic_message_t *) request, request_length); - SL_WFX_ERROR_CHECK(result); - - result = sl_wfx_host_wait_for_confirmation(command_id, SL_WFX_DEFAULT_REQUEST_TIMEOUT_MS, (void **) &counters); - SL_WFX_ERROR_CHECK(result); - - ChipLogDetail(DeviceLayer, "%-24s %12s ", "", "Debug Counters Content"); - ChipLogDetail(DeviceLayer, "%-24s %lu", "rcpi", (unsigned long) counters->body.rcpi); - PUT_COUNTER(plcp_errors); - PUT_COUNTER(fcs_errors); - PUT_COUNTER(tx_packets); - PUT_COUNTER(rx_packets); - PUT_COUNTER(rx_packet_errors); - PUT_COUNTER(rx_decryption_failures); - PUT_COUNTER(rx_mic_failures); - PUT_COUNTER(rx_no_key_failures); - PUT_COUNTER(tx_multicast_frames); - PUT_COUNTER(tx_frames_success); - PUT_COUNTER(tx_frame_failures); - PUT_COUNTER(tx_frames_retried); - PUT_COUNTER(tx_frames_multi_retried); - PUT_COUNTER(rx_frame_duplicates); - PUT_COUNTER(rts_success); - PUT_COUNTER(rts_failures); - PUT_COUNTER(ack_failures); - PUT_COUNTER(rx_multicast_frames); - PUT_COUNTER(rx_frames_success); - PUT_COUNTER(rx_cmacicv_errors); - PUT_COUNTER(rx_cmac_replays); - PUT_COUNTER(rx_mgmt_ccmp_replays); - PUT_COUNTER(rx_bipmic_errors); - PUT_COUNTER(rx_beacon); - PUT_COUNTER(miss_beacon); - -error_handler: - - if (result == SL_STATUS_TIMEOUT) - { - if (sl_wfx_context->used_buffers > 0) - { - sl_wfx_context->used_buffers--; - } - } - if (request != nullptr) - { - sl_wfx_free_command_buffer((sl_wfx_generic_message_t *) request, command_id, SL_WFX_CONTROL_BUFFER); - } - - return result; -} - /************************************************************************ * @brief * reset the count @@ -879,16 +982,6 @@ sl_status_t wfx_wifi_start(void) return SL_STATUS_OK; } -/**************************************************************************** - * @brief - * get the wifi state - * @return returns wificonetext state - *****************************************************************************/ -sl_wfx_state_t wfx_get_wifi_state(void) -{ - return wifiContext.state; -} - /**************************************************************************** * @brief * getnetif using interface @@ -911,19 +1004,6 @@ struct netif * wfx_GetNetif(sl_wfx_interface_t interface) return SelectedNetif; } -/**************************************************************************** - * @brief - * get the wifi mac address using interface - * @param[in] interface: - * @return returns wificontext.mac_addr_o if successful, - * wificontext.mac_addr_1 otherwise - *****************************************************************************/ -sl_wfx_mac_address_t wfx_get_wifi_mac_addr(sl_wfx_interface_t interface) -{ - // return Mac address used by WFX SL_WFX_STA_INTERFACE or SL_WFX_SOFTAP_INTERFACE, - return (interface == SL_WFX_STA_INTERFACE) ? wifiContext.mac_addr_0 : wifiContext.mac_addr_1; -} - /**************************************************************************** * @brief * set the wifi provision @@ -962,17 +1042,6 @@ void wfx_clear_wifi_provision(void) memset(&wifi_provision, 0, sizeof(wifi_provision)); } -/**************************************************************************** - * @brief - * driver STA provisioned - * @return returns true if successful, - * false otherwise - *****************************************************************************/ -bool wfx_is_sta_provisioned(void) -{ - return (wifi_provision.ssid[0]) ? true : false; -} - /**************************************************************************** * @fn sl_status_t wfx_connect_to_ap(void) * @brief @@ -1071,7 +1140,7 @@ bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) * @returns Returns SL_STATUS_OK if successful, * SL_STATUS_FAIL otherwise *****************************************************************************/ -sl_status_t wfx_sta_discon(void) +sl_status_t sl_matter_wifi_disconnect(void) { ChipLogProgress(DeviceLayer, "STA-Disconnecting"); int32_t status = sl_wfx_send_disconnect_command(); @@ -1149,10 +1218,10 @@ void wfx_dhcp_got_ipv4(uint32_t ip) */ uint8_t ip4_addr[4]; - ip4_addr[0] = (ip) &HEX_VALUE_FF; - ip4_addr[1] = (ip >> 8) & HEX_VALUE_FF; - ip4_addr[2] = (ip >> 16) & HEX_VALUE_FF; - ip4_addr[3] = (ip >> 24) & HEX_VALUE_FF; + ip4_addr[0] = (ip) &0xFF; + ip4_addr[1] = (ip >> 8) & 0xFF; + ip4_addr[2] = (ip >> 16) & 0xFF; + ip4_addr[3] = (ip >> 24) & 0xFF; ChipLogDetail(DeviceLayer, "DHCP IP=%d.%d.%d.%d", ip4_addr[0], ip4_addr[1], ip4_addr[2], ip4_addr[3]); sta_ip = ip; diff --git a/examples/platform/silabs/efr32/wf200/efr_spi.c b/src/platform/silabs/wifi/wf200/platform/efr_spi.c similarity index 99% rename from examples/platform/silabs/efr32/wf200/efr_spi.c rename to src/platform/silabs/wifi/wf200/platform/efr_spi.c index 3ef34c928e..6f80fc83d9 100644 --- a/examples/platform/silabs/efr32/wf200/efr_spi.c +++ b/src/platform/silabs/wifi/wf200/platform/efr_spi.c @@ -14,14 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include -#include - -#include "AppConfig.h" #include "FreeRTOS.h" -#include "semphr.h" - #include "dmadrv.h" #include "em_bus.h" #include "em_cmu.h" @@ -29,6 +22,7 @@ #include "em_ldma.h" #include "em_usart.h" #include "gpiointerrupt.h" +#include "semphr.h" #include "sl_spidrv_exp_config.h" #include "sl_spidrv_instances.h" #include "sl_wfx.h" @@ -38,9 +32,10 @@ #include "sl_wfx_host_api.h" #include "sl_wfx_task.h" #include "spidrv.h" - -#include "spi_multiplex.h" -#include "wfx_host_events.h" +#include +#include +#include +#include #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #include "sl_power_manager.h" @@ -442,6 +437,8 @@ sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) #endif // SL_SPICTRL_MUX return SL_STATUS_OK; } +#else +#error still not working #endif // SL_LCDCTRL_MUX #if SL_UARTCTRL_MUX diff --git a/examples/platform/silabs/efr32/sl_custom_board.h b/src/platform/silabs/wifi/wf200/platform/sl_custom_board.h similarity index 100% rename from examples/platform/silabs/efr32/sl_custom_board.h rename to src/platform/silabs/wifi/wf200/platform/sl_custom_board.h diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_board.h b/src/platform/silabs/wifi/wf200/platform/sl_wfx_board.h similarity index 100% rename from examples/platform/silabs/efr32/wf200/sl_wfx_board.h rename to src/platform/silabs/wifi/wf200/platform/sl_wfx_board.h diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_host.h b/src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h similarity index 100% rename from examples/platform/silabs/efr32/wf200/sl_wfx_host.h rename to src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_task.c b/src/platform/silabs/wifi/wf200/platform/sl_wfx_task.c similarity index 100% rename from examples/platform/silabs/efr32/wf200/sl_wfx_task.c rename to src/platform/silabs/wifi/wf200/platform/sl_wfx_task.c diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_task.h b/src/platform/silabs/wifi/wf200/platform/sl_wfx_task.h similarity index 100% rename from examples/platform/silabs/efr32/wf200/sl_wfx_task.h rename to src/platform/silabs/wifi/wf200/platform/sl_wfx_task.h diff --git a/examples/platform/silabs/efr32/spi_multiplex.h b/src/platform/silabs/wifi/wf200/platform/spi_multiplex.h similarity index 100% rename from examples/platform/silabs/efr32/spi_multiplex.h rename to src/platform/silabs/wifi/wf200/platform/spi_multiplex.h diff --git a/examples/platform/silabs/efr32/wf200/wf200_init.c b/src/platform/silabs/wifi/wf200/platform/wf200_init.c similarity index 97% rename from examples/platform/silabs/efr32/wf200/wf200_init.c rename to src/platform/silabs/wifi/wf200/platform/wf200_init.c index 3631216e76..40f1aaf08a 100644 --- a/examples/platform/silabs/efr32/wf200/wf200_init.c +++ b/src/platform/silabs/wifi/wf200/platform/wf200_init.c @@ -40,7 +40,6 @@ #include "AppConfig.h" #include "sl_wfx_host.h" #include "sl_wfx_task.h" -#include "wfx_host_events.h" #include "sl_spidrv_instances.h" #include "spidrv.h" @@ -258,7 +257,7 @@ sl_status_t sl_wfx_host_set_wake_up_pin(uint8_t state) CORE_DECLARE_IRQ_STATE; CORE_ENTER_ATOMIC(); - if (state > PINOUT_CLEAR_STATUS) + if (state > 0) { #ifdef SLEEP_ENABLED #ifdef SL_WFX_USE_SDIO @@ -320,8 +319,7 @@ sl_status_t sl_wfx_host_reset_chip(void) *****************************************************************************/ sl_status_t sl_wfx_host_wait_for_wake_up(void) { - xSemaphoreTake(wfx_wakeup_sem, pdMS_TO_TICKS(TICKS_TO_WAIT_0)); - xSemaphoreTake(wfx_wakeup_sem, pdMS_TO_TICKS(TICKS_TO_WAIT_3)); + xSemaphoreTake(wfx_wakeup_sem, pdMS_TO_TICKS(3)); return SL_STATUS_OK; } @@ -388,7 +386,7 @@ sl_status_t sl_wfx_host_wait_for_confirmation(uint8_t confirmation_id, uint32_t for (uint32_t i = 0; i < timeout; i++) { /* Wait for an event posted by the function sl_wfx_host_post_event() */ - if (xQueueReceive(wfx_event_Q, &posted_event_id, TICKS_TO_WAIT_1) == pdTRUE) + if (xQueueReceive(wfx_event_Q, &posted_event_id, 1) == pdTRUE) { /* Once a message is received, check if it is the expected ID */ if (confirmation_id == posted_event_id) @@ -418,7 +416,7 @@ sl_status_t sl_wfx_host_lock(void) sl_status_t status = SL_STATUS_OK; - if (xSemaphoreTake(wfx_mutex, pdMS_TO_TICKS(TICKS_TO_WAIT_500)) != pdTRUE) + if (xSemaphoreTake(wfx_mutex, pdMS_TO_TICKS(500)) != pdTRUE) { SILABS_LOG("*ERR*Wi-Fi driver mutex timo"); status = SL_STATUS_TIMEOUT; diff --git a/src/platform/silabs/wifi/wf200/wf200.gni b/src/platform/silabs/wifi/wf200/wf200.gni new file mode 100644 index 0000000000..437f9def5d --- /dev/null +++ b/src/platform/silabs/wifi/wf200/wf200.gni @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/efr32_sdk.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") + +wf200_plat_src = [ + "${chip_root}/src/platform/silabs/wifi/wf200/WifiInterface.cpp", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_task.c", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/wf200_init.c", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/efr_spi.c", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_board.h", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_task.h", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_custom_board.h", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/spi_multiplex.h", + "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_board.h", +] diff --git a/src/platform/silabs/SiWx917/wifi/wfx_msgs.h b/src/platform/silabs/wifi/wfx_msgs.h similarity index 95% rename from src/platform/silabs/SiWx917/wifi/wfx_msgs.h rename to src/platform/silabs/wifi/wfx_msgs.h index b87a7c0707..af167a1f2c 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_msgs.h +++ b/src/platform/silabs/wifi/wfx_msgs.h @@ -15,15 +15,17 @@ * limitations under the License. */ +// TODO: Delete this file after moving the wifi abstraction files to the src directory. +// Nothing should be added to this file anymore. +// File is kept due to the current header inclusion structure. + #ifndef _WFX_MSGS_H_ #define _WFX_MSGS_H_ -#include -/* - * Taken from sl_wfx firmware - so I can re-use. - * I need to do a better job than to use this stuff - * in the CPP files of Matter - */ +#ifdef WF200_WIFI +#include "sl_wfx_api.h" +#include "sl_wfx_constants.h" +#else typedef struct { uint8_t octet[6]; ///< Table to store a MAC address @@ -158,5 +160,6 @@ typedef struct __attribute__((__packed__)) sl_wfx_disconnect_ind_s /** Indication message body. */ sl_wfx_disconnect_ind_body_t body; } sl_wfx_disconnect_ind_t; +#endif #endif /* _WFX_MSGS_H_ */ diff --git a/examples/platform/silabs/wifi/wfx_rsi_host.cpp b/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp similarity index 76% rename from examples/platform/silabs/wifi/wfx_rsi_host.cpp rename to src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp index d76bc9c795..2266989b90 100644 --- a/examples/platform/silabs/wifi/wfx_rsi_host.cpp +++ b/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2024 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -10,35 +10,21 @@ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include -#include -#include - -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" - -#include #include -#include #include +#include -#include "wfx_host_events.h" -#include "wfx_rsi.h" - -#include +namespace { // Thread for the WLAN RSI -static osThreadId_t sWlanThread; +osThreadId_t sWlanThread; constexpr uint32_t kWlanTaskSize = 2048; -static uint8_t wlanStack[kWlanTaskSize]; -static osThread_t sWlanTaskControlBlock; +uint8_t wlanStack[kWlanTaskSize]; +osThread_t sWlanTaskControlBlock; constexpr osThreadAttr_t kWlanTaskAttr = { .name = "wlan_rsi", .attr_bits = osThreadDetached, .cb_mem = &sWlanTaskControlBlock, @@ -47,6 +33,8 @@ constexpr osThreadAttr_t kWlanTaskAttr = { .name = "wlan_rsi", .stack_size = kWlanTaskSize, .priority = osPriorityAboveNormal7 }; +} // namespace + /********************************************************************* * @fn sl_status_t wfx_wifi_start(void) * @brief @@ -58,15 +46,15 @@ constexpr osThreadAttr_t kWlanTaskAttr = { .name = "wlan_rsi", ***********************************************************************/ sl_status_t wfx_wifi_start(void) { - VerifyOrReturnError(!(wfx_rsi.dev_state & WFX_RSI_ST_STARTED), SL_STATUS_OK); - wfx_rsi.dev_state |= WFX_RSI_ST_STARTED; + VerifyOrReturnError(!(wfx_rsi.dev_state.Has(WifiState::kStationStarted)), SL_STATUS_OK); + wfx_rsi.dev_state.Set(WifiState::kStationStarted); // Creating a Wi-Fi driver thread - sWlanThread = osThreadNew(wfx_rsi_task, NULL, &kWlanTaskAttr); + sWlanThread = osThreadNew(sl_matter_wifi_task, NULL, &kWlanTaskAttr); VerifyOrReturnError(sWlanThread != NULL, SL_STATUS_FAIL); - ChipLogProgress(DeviceLayer, "wfx_rsi_task created successfully"); + ChipLogProgress(DeviceLayer, "sl_matter_wifi_task created successfully"); return SL_STATUS_OK; } @@ -79,7 +67,7 @@ sl_status_t wfx_wifi_start(void) ***********************************************************************/ void wfx_enable_sta_mode(void) { - wfx_rsi.dev_state |= WFX_RSI_ST_STA_MODE; + wfx_rsi.dev_state.Set(WifiState::kStationMode); } /********************************************************************* @@ -91,9 +79,7 @@ void wfx_enable_sta_mode(void) ***********************************************************************/ bool wfx_is_sta_mode_enabled(void) { - bool mode; - mode = !!(wfx_rsi.dev_state & WFX_RSI_ST_STA_MODE); - return mode; + return wfx_rsi.dev_state.Has(WifiState::kStationMode); } /********************************************************************* @@ -127,7 +113,7 @@ void wfx_set_wifi_provision(wfx_wifi_provision_t * cfg) { VerifyOrReturn(cfg != nullptr); wfx_rsi.sec = *cfg; - wfx_rsi.dev_state |= WFX_RSI_ST_STA_PROVISIONED; + wfx_rsi.dev_state.Set(WifiState::kStationProvisioned); } /********************************************************************* @@ -141,7 +127,7 @@ void wfx_set_wifi_provision(wfx_wifi_provision_t * cfg) bool wfx_get_wifi_provision(wfx_wifi_provision_t * wifiConfig) { VerifyOrReturnError(wifiConfig != nullptr, false); - VerifyOrReturnError(wfx_rsi.dev_state & WFX_RSI_ST_STA_PROVISIONED, false); + VerifyOrReturnError(wfx_rsi.dev_state.Has(WifiState::kStationProvisioned), false); *wifiConfig = wfx_rsi.sec; return true; } @@ -156,7 +142,7 @@ bool wfx_get_wifi_provision(wfx_wifi_provision_t * wifiConfig) void wfx_clear_wifi_provision(void) { memset(&wfx_rsi.sec, 0, sizeof(wfx_rsi.sec)); - wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_PROVISIONED; + wfx_rsi.dev_state.Clear(WifiState::kStationProvisioned); ChipLogProgress(DeviceLayer, "Clear WiFi Provision"); } @@ -169,47 +155,15 @@ void wfx_clear_wifi_provision(void) ****************************************************************************/ sl_status_t wfx_connect_to_ap(void) { - VerifyOrReturnError(wfx_rsi.dev_state & WFX_RSI_ST_STA_PROVISIONED, SL_STATUS_INVALID_CONFIGURATION); + VerifyOrReturnError(wfx_rsi.dev_state.Has(WifiState::kStationProvisioned), SL_STATUS_INVALID_CONFIGURATION); VerifyOrReturnError(wfx_rsi.sec.ssid_length, SL_STATUS_INVALID_CREDENTIALS); VerifyOrReturnError(wfx_rsi.sec.ssid_length <= WFX_MAX_SSID_LENGTH, SL_STATUS_HAS_OVERFLOWED); ChipLogProgress(DeviceLayer, "connect to access point: %s", wfx_rsi.sec.ssid); - WfxEvent_t event; - event.eventType = WFX_EVT_STA_START_JOIN; - WfxPostEvent(&event); - return SL_STATUS_OK; -} -#if SL_ICD_ENABLED -#if SLI_SI917 -/********************************************************************* - * @fn sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t - sl_si91x_wifi_state) - * @brief - * Implements the power save in sleepy application - * @param[in] sl_si91x_ble_state : State to set for the BLE - sl_si91x_wifi_state : State to set for the WiFi - * @return SL_STATUS_OK if successful, - * SL_STATUS_FAIL otherwise - ***********************************************************************/ -sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) -{ - return (wfx_rsi_power_save(sl_si91x_ble_state, sl_si91x_wifi_state) ? SL_STATUS_FAIL : SL_STATUS_OK); -} -#else // For RS9116 -/********************************************************************* - * @fn sl_status_t wfx_power_save(void) - * @brief - * Implements the power save in sleepy application - * @param[in] None - * @return SL_STATUS_OK if successful, - * SL_STATUS_FAIL otherwise - ***********************************************************************/ -sl_status_t wfx_power_save(void) -{ - return (wfx_rsi_power_save() ? SL_STATUS_FAIL : SL_STATUS_OK); + WifiEvent event = WifiEvent::kStationStartJoin; + sl_matter_wifi_post_event(event); + return SL_STATUS_OK; } -#endif /* SLI_SI917 */ -#endif /* SL_ICD_ENABLED */ /********************************************************************* * @fn void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif) @@ -221,7 +175,7 @@ sl_status_t wfx_power_save(void) void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif) { /* - * TODO: Implement IPV6 setup, currently in wfx_rsi_task() + * TODO: Implement IPV6 setup, currently in sl_matter_wifi_task() * This is hooked with MATTER code. */ } @@ -236,8 +190,7 @@ void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif) ***********************************************************************/ bool wfx_is_sta_connected(void) { - bool status = (wfx_rsi.dev_state & WFX_RSI_ST_STA_CONNECTED) > 0; - return status; + return wfx_rsi.dev_state.Has(WifiState::kStationConnected); } /********************************************************************* @@ -250,24 +203,24 @@ bool wfx_is_sta_connected(void) ***********************************************************************/ wifi_mode_t wfx_get_wifi_mode(void) { - if (wfx_rsi.dev_state & WFX_RSI_ST_DEV_READY) + if (wfx_rsi.dev_state.Has(WifiState::kStationInit)) return WIFI_MODE_STA; return WIFI_MODE_NULL; } /********************************************************************* - * @fn sl_status_t wfx_sta_discon(void) + * @fn sl_status_t sl_matter_wifi_disconnect(void) * @brief * called fuction when STA disconnected * @param[in] None * @return return SL_STATUS_OK if successful, * SL_STATUS_FAIL otherwise ***********************************************************************/ -sl_status_t wfx_sta_discon(void) +sl_status_t sl_matter_wifi_disconnect(void) { sl_status_t status; - status = wfx_rsi_disconnect(); - wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTED; + status = sl_wifi_platform_disconnect(); + wfx_rsi.dev_state.Clear(WifiState::kStationConnected); return status; } #if CHIP_DEVICE_CONFIG_ENABLE_IPV4 @@ -282,7 +235,7 @@ sl_status_t wfx_sta_discon(void) bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if) { VerifyOrReturnError(which_if == SL_WFX_STA_INTERFACE, false); - return ((wfx_rsi.dev_state & WFX_RSI_ST_STA_DHCP_DONE) > 0); + return wfx_rsi.dev_state.Has(WifiState::kStationDhcpDone); } #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ @@ -297,8 +250,8 @@ bool wfx_have_ipv4_addr(sl_wfx_interface_t which_if) bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) { VerifyOrReturnError(which_if == SL_WFX_STA_INTERFACE, false); - // TODO: WFX_RSI_ST_STA_CONNECTED does not guarantee SLAAC IPv6 LLA, maybe use a different FLAG - return ((wfx_rsi.dev_state & WFX_RSI_ST_STA_CONNECTED) > 0); + // TODO: WifiState::kStationConnected does not guarantee SLAAC IPv6 LLA, maybe use a different FLAG + return wfx_rsi.dev_state.Has(WifiState::kStationConnected); } /********************************************************************* @@ -311,7 +264,7 @@ bool wfx_have_ipv6_addr(sl_wfx_interface_t which_if) ***********************************************************************/ bool wfx_hw_ready(void) { - return (wfx_rsi.dev_state & WFX_RSI_ST_DEV_READY) ? true : false; + return wfx_rsi.dev_state.Has(WifiState::kStationInit); } /********************************************************************* @@ -374,9 +327,8 @@ bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *)) VerifyOrReturnError(wfx_rsi.scan_ssid != nullptr, false); chip::Platform::CopyString(wfx_rsi.scan_ssid, wfx_rsi.scan_ssid_length, ssid); - WfxEvent_t event; - event.eventType = WFX_EVT_SCAN; - WfxPostEvent(&event); + WifiEvent event = WifiEvent::kScan; + sl_matter_wifi_post_event(event); return true; } diff --git a/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h b/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h new file mode 100644 index 0000000000..9073a02ef6 --- /dev/null +++ b/src/platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h @@ -0,0 +1,47 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include +#include +#include +#include + +#define WFX_RSI_DHCP_POLL_INTERVAL (250) /* Poll interval in ms for DHCP */ +#define GET_IPV6_SUCCESS (1) + +extern WfxRsi_t wfx_rsi; + +void sl_matter_wifi_task(void * arg); + +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 +void wfx_ip_changed_notify(int got_ip); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + +int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap); +int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); +int32_t wfx_rsi_reset_count(); +int32_t sl_wifi_platform_disconnect(); + +sl_status_t sl_matter_wifi_platform_init(void); + +/** + * @brief Posts an event to the Wi-Fi task + * + * @param[in] event Event to process. + */ +void sl_matter_wifi_post_event(WifiEvent event); diff --git a/src/platform/webos/DiagnosticDataProviderImpl.cpp b/src/platform/webos/DiagnosticDataProviderImpl.cpp index 22f90ed72e..51868a556e 100644 --- a/src/platform/webos/DiagnosticDataProviderImpl.cpp +++ b/src/platform/webos/DiagnosticDataProviderImpl.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index 4bf1aa5521..ceeaaa6053 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -54,9 +54,7 @@ using namespace Crypto; using namespace Messaging; using namespace Protocols::SecureChannel; -const char kSpake2pContext[] = "CHIP PAKE V1 Commissioning"; -const char kSpake2pI2RSessionInfo[] = "Commissioning I2R Key"; -const char kSpake2pR2ISessionInfo[] = "Commissioning R2I Key"; +const char kSpake2pContext[] = "CHIP PAKE V1 Commissioning"; // Amounts of time to allow for server-side processing of messages. // diff --git a/src/protocols/secure_channel/PASESession.h b/src/protocols/secure_channel/PASESession.h index 92b4ee3d8b..a24539eaf5 100644 --- a/src/protocols/secure_channel/PASESession.h +++ b/src/protocols/secure_channel/PASESession.h @@ -43,7 +43,9 @@ #include namespace chip { - +namespace Testing { +class TestPASESession; +} extern const char kSpake2pI2RSessionInfo[]; extern const char kSpake2pR2ISessionInfo[]; @@ -174,6 +176,7 @@ class DLL_EXPORT PASESession : public Messaging::UnsolicitedMessageHandler, kInvalidKeyConfirmation = 0x00, kUnexpected = 0xff, }; + friend class Testing::TestPASESession; CHIP_ERROR Init(SessionManager & sessionManager, uint32_t setupCode, SessionEstablishmentDelegate * delegate); diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index a5e6d73455..415db1bbd7 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -1,6 +1,8 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") + import("${chip_root}/build/chip/chip_test_suite.gni") +import("${chip_root}/build/chip/fuzz_test.gni") import("${chip_root}/src/app/icd/icd.gni") chip_test_suite("tests") { @@ -45,3 +47,25 @@ chip_test_suite("tests") { public_deps += [ "${chip_root}/src/app/icd/server:configuration-data" ] } } +if (pw_enable_fuzz_test_targets) { + chip_pw_fuzz_target("fuzz-PASE-pw") { + test_source = [ "FuzzPASE_PW.cpp" ] + public_deps = [ + "${chip_root}/src/app/icd/server:icd-server-config", + "${chip_root}/src/credentials/tests:cert_test_vectors", + "${chip_root}/src/crypto/tests:tests.lib", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:test_utils", + "${chip_root}/src/lib/support:testing", + "${chip_root}/src/lib/support/tests:pw-test-macros", + "${chip_root}/src/messaging/tests:helpers", + "${chip_root}/src/protocols", + "${chip_root}/src/protocols/secure_channel", + "${chip_root}/src/protocols/secure_channel:check-in-counter", + "${chip_root}/src/transport/raw/tests:helpers", + "${dir_pw_unit_test}", + ] + } +} diff --git a/src/protocols/secure_channel/tests/FuzzPASE_PW.cpp b/src/protocols/secure_channel/tests/FuzzPASE_PW.cpp new file mode 100644 index 0000000000..0ce3d2d181 --- /dev/null +++ b/src/protocols/secure_channel/tests/FuzzPASE_PW.cpp @@ -0,0 +1,937 @@ +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace Testing { + +using namespace std; + +using namespace Crypto; +using namespace fuzztest; +using namespace Transport; +using namespace Messaging; +using namespace System::Clock::Literals; + +// TODO: #35369 Refactor the classes below to Fixtures once Errors related to FuzzTest Fixtures are resolved +class FuzzLoopbackMessagingContext : public chip::Test::MessagingContext +{ +public: + ~FuzzLoopbackMessagingContext() {} + + // These functions wrap spLoopbackTransportManager methods + static auto & GetSystemLayer() { return spLoopbackTransportManager->GetSystemLayer(); } + static auto & GetLoopback() { return spLoopbackTransportManager->GetLoopback(); } + static auto & GetTransportMgr() { return spLoopbackTransportManager->GetTransportMgr(); } + static auto & GetIOContext() { return spLoopbackTransportManager->GetIOContext(); } + + template + static void DrainAndServiceIO(Ts... args) + { + return spLoopbackTransportManager->DrainAndServiceIO(args...); + } + + // Performs shared setup for all tests in the test suite + static void SetUpTestSuite() + { + // Initialize memory. + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + // Instantiate the LoopbackTransportManager. + ASSERT_EQ(spLoopbackTransportManager, nullptr); + spLoopbackTransportManager = new chip::Test::LoopbackTransportManager(); + ASSERT_NE(spLoopbackTransportManager, nullptr); + // Initialize the LoopbackTransportManager. + ASSERT_EQ(spLoopbackTransportManager->Init(), CHIP_NO_ERROR); + } + + // Performs shared teardown for all tests in the test suite + static void TearDownTestSuite() + { + // Shutdown the LoopbackTransportManager. + spLoopbackTransportManager->Shutdown(); + // Destroy the LoopbackTransportManager. + if (spLoopbackTransportManager != nullptr) + { + delete spLoopbackTransportManager; + spLoopbackTransportManager = nullptr; + } + // Shutdown memory. + chip::Platform::MemoryShutdown(); + } + + // Performs setup for each individual test in the test suite + void SetUp() { ASSERT_EQ(MessagingContext::Init(&GetTransportMgr(), &GetIOContext()), CHIP_NO_ERROR); } + + // Performs teardown for each individual test in the test suite + void TearDown() { MessagingContext::Shutdown(); } + + static chip::Test::LoopbackTransportManager * spLoopbackTransportManager; +}; +chip::Test::LoopbackTransportManager * FuzzLoopbackMessagingContext::spLoopbackTransportManager = nullptr; + +class TestSecurePairingDelegate : public SessionEstablishmentDelegate +{ +public: + void OnSessionEstablishmentError(CHIP_ERROR error) override { mNumPairingErrors++; } + + void OnSessionEstablished(const SessionHandle & session) override { mNumPairingComplete++; } + + uint32_t mNumPairingErrors = 0; + uint32_t mNumPairingComplete = 0; +}; + +class TestPASESession : public FuzzLoopbackMessagingContext +{ +public: + TestPASESession() + { + ConfigInitializeNodes(false); + FuzzLoopbackMessagingContext::SetUpTestSuite(); + FuzzLoopbackMessagingContext::SetUp(); + } + ~TestPASESession() + { + FuzzLoopbackMessagingContext::TearDown(); + FuzzLoopbackMessagingContext::TearDownTestSuite(); + } + + void SecurePairingHandshake(SessionManager & sessionManager, PASESession & pairingCommissioner, + TestSecurePairingDelegate & delegateCommissioner, TestSecurePairingDelegate & delegateAccessory, + const Spake2pVerifier & verifier, uint32_t pbkdf2IterCount, const ByteSpan & salt, + uint32_t SetUpPINCode); + + void FuzzHandlePBKDFParamRequest(vector fuzzPBKDFLocalRandomData, uint32_t fuzzInitiatorSessionId, + bool fuzzHavePBKDFParameters); + + void FuzzHandlePBKDFParamResponse(vector fuzzPBKDFLocalRandomDataInitiator, + vector fuzzPBKDFLocalRandomDataResponder, uint32_t fuzzResponderSessionId, + const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, bool fuzzHavePBKDFParameters); + + void FuzzHandlePake1(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + const vector & pA); + + void FuzzHandlePake2(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + const vector & pB, const vector & cB); + + void FuzzHandlePake3(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + const vector & cA); + + CHIP_ERROR CallAllocateSecureSession(SessionManager & sessionManager, PASESession & pairing) + { + return pairing.AllocateSecureSession(sessionManager); + } +}; + +class TemporarySessionManager +{ +public: + TemporarySessionManager(TestPASESession & ctx) : mCtx(ctx) + { + EXPECT_EQ(CHIP_NO_ERROR, + mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), &mStorage, + &ctx.GetFabricTable(), ctx.GetSessionKeystore())); + // The setup here is really weird: we are using one session manager for + // the actual messages we send (the PASE handshake, so the + // unauthenticated sessions) and a different one for allocating the PASE + // sessions. Since our Init() set us up as the thing to handle messages + // on the transport manager, undo that. + mCtx.GetTransportMgr().SetSessionManager(&mCtx.GetSecureSessionManager()); + } + + ~TemporarySessionManager() + { + mSessionManager.Shutdown(); + // Reset the session manager on the transport again, just in case + // shutdown messed with it. + mCtx.GetTransportMgr().SetSessionManager(&mCtx.GetSecureSessionManager()); + } + + operator SessionManager &() { return mSessionManager; } + +private: + TestPASESession & mCtx; + TestPersistentStorageDelegate mStorage; + SessionManager mSessionManager; +}; + +class PASETestLoopbackTransportDelegate : public Test::LoopbackTransportDelegate +{ +public: + void OnMessageDropped() override { mMessageDropped = true; } + bool mMessageDropped = false; +}; + +void TestPASESession::SecurePairingHandshake(SessionManager & sessionManager, PASESession & pairingCommissioner, + TestSecurePairingDelegate & delegateCommissioner, + TestSecurePairingDelegate & delegateAccessory, const Spake2pVerifier & verifier, + uint32_t pbkdf2IterCount, const ByteSpan & salt, uint32_t SetUpPINCode) +{ + + PASESession pairingAccessory; + + PASETestLoopbackTransportDelegate delegate; + auto & loopback = GetLoopback(); + loopback.SetLoopbackTransportDelegate(&delegate); + loopback.mSentMessageCount = 0; + + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); + + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest, + &pairingAccessory), + CHIP_NO_ERROR); + + pairingAccessory.WaitForPairing(sessionManager, verifier, pbkdf2IterCount, salt, + Optional::Missing(), &delegateAccessory); + DrainAndServiceIO(); + + pairingCommissioner.Pair(sessionManager, SetUpPINCode, Optional::Missing(), contextCommissioner, + &delegateCommissioner); + + DrainAndServiceIO(); +} + +//----------------------------------------**********Fuzz Tests*********------------------------------------------------ + +// This Fuzz Test should always result in Successful PASE Pairing, since all fuzzed inputs are within the valid bounds +void PASESession_Bounded(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter) +{ + + Spake2pVerifier fuzzedSpake2pVerifier; + ByteSpan fuzzedSaltSpan{ fuzzedSalt.data(), fuzzedSalt.size() }; + + // Generating the Spake2+ verifier from the fuzzed inputs + EXPECT_EQ(fuzzedSpake2pVerifier.Generate(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode), CHIP_NO_ERROR); + + // TODO: #35369 Move this to a Fixture once Errors related to FuzzTest Fixtures are resolved + TestPASESession PASELoopBack; + TemporarySessionManager sessionManager(PASELoopBack); + + PASESession pairingCommissioner; + + TestSecurePairingDelegate delegateCommissioner; + TestSecurePairingDelegate delegateCommissionee; + + PASELoopBack.SecurePairingHandshake(sessionManager, pairingCommissioner, delegateCommissioner, delegateCommissionee, + fuzzedSpake2pVerifier, fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); + + // Given that the inputs to this Fuzz Test are within the expected boundaries, the Pairing should Always be successful. + EXPECT_EQ(delegateCommissionee.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); + + EXPECT_EQ(delegateCommissionee.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); +} + +FUZZ_TEST(FuzzPASE_PW, PASESession_Bounded) + .WithDomains( + // fuzzedSetupPasscode: Tests the full 27-bit range allowed by the stack (0 to 0x7FFFFFF) + InRange(00000000, 0x7FFFFFF), + // fuzzedSalt + Arbitrary>().WithMinSize(kSpake2p_Min_PBKDF_Salt_Length).WithMaxSize(kSpake2p_Max_PBKDF_Salt_Length), + // fuzzedPBKDF2Iter + InRange(kSpake2p_Min_PBKDF_Iterations, kSpake2p_Max_PBKDF_Iterations)); + +/* -------------------------------------------------------------------------------------------*/ +// This Fuzz Test is the equivalent of the previous one, but with the fuzzed inputs not being within the valid bounds. +void PASESession_Unbounded(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter) +{ + + Spake2pVerifier fuzzedSpake2pVerifier; + ByteSpan fuzzedSaltSpan{ fuzzedSalt.data(), fuzzedSalt.size() }; + + // Generating the Spake2+ verifier from fuzzed inputs + fuzzedSpake2pVerifier.Generate(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); + + TestPASESession PASELoopBack; + TemporarySessionManager sessionManager(PASELoopBack); + + PASESession pairingCommissioner; + + TestSecurePairingDelegate delegateCommissioner; + TestSecurePairingDelegate delegateCommissionee; + + PASELoopBack.SecurePairingHandshake(sessionManager, pairingCommissioner, delegateCommissioner, delegateCommissionee, + fuzzedSpake2pVerifier, fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); +} + +FUZZ_TEST(FuzzPASE_PW, PASESession_Unbounded) + .WithDomains( + // fuzzedSetupPasscode + Arbitrary(), + // fuzzedSalt + Arbitrary>(), + // fuzzedPBKDF2Iter + Arbitrary()); + +/* -------------------------------------------------------------------------------------------*/ +// In This FuzzTest, the Spake2pVerifier is fuzzed. +void FuzzSpake2pVerifier(const vector & aW0, const vector & aL, const vector & aSalt, + const uint32_t fuzzedPBKDF2Iter, const uint32_t fuzzedSetupPasscode) +{ + Spake2pVerifier fuzzedSpake2pVerifier; + + copy_n(aW0.data(), aW0.size(), fuzzedSpake2pVerifier.mW0); + copy_n(aL.data(), aL.size(), fuzzedSpake2pVerifier.mL); + + ByteSpan fuzzedSaltSpan(aSalt.data(), aSalt.size()); + + TestPASESession PASELoopBack; + TemporarySessionManager sessionManager(PASELoopBack); + + PASESession pairingCommissioner; + + TestSecurePairingDelegate delegateCommissioner; + TestSecurePairingDelegate delegateCommissionee; + + PASELoopBack.SecurePairingHandshake(sessionManager, pairingCommissioner, delegateCommissioner, delegateCommissionee, + fuzzedSpake2pVerifier, fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); +} +FUZZ_TEST(FuzzPASE_PW, FuzzSpake2pVerifier) + .WithDomains( + // aW0 + Arbitrary>().WithMaxSize(kP256_FE_Length), + // aL + Arbitrary>().WithMaxSize(kP256_Point_Length), + // aSalt + Arbitrary>(), + // fuzzedPBKDF2Iter + Arbitrary(), + // fuzzedSetupPasscode + Arbitrary()); + +/* -------------------------------------------------------------------------------------------*/ +// In This FuzzTest, Fuzzed Serialized Verifier is deserialized and Serialized Again, comparing the original with RoundTrip result. +void Spake2pVerifier_Serialize_RoundTrip(const vector & FuzzedSerializedVerifier) +{ + + Spake2pVerifierSerialized FuzzedSerializedVerifierArray; + + copy_n(FuzzedSerializedVerifier.data(), FuzzedSerializedVerifier.size(), FuzzedSerializedVerifierArray); + + // Deserialize the fuzzed SPAKE2+ Verifier + Spake2pVerifier verifier; + EXPECT_EQ(verifier.Deserialize(ByteSpan(FuzzedSerializedVerifierArray)), CHIP_NO_ERROR); + + // Serialize the fuzzed SPAKE2+ Verifier again + Spake2pVerifierSerialized reserializedVerifier; + MutableByteSpan reserializedVerifierSpan(reserializedVerifier); + EXPECT_EQ(verifier.Serialize(reserializedVerifierSpan), CHIP_NO_ERROR); + EXPECT_EQ(reserializedVerifierSpan.size(), kSpake2p_VerifierSerialized_Length); + + // The original fuzzed SPAKE2+ verifier should be the same as the deserialized and re-serialized verifier (RoundTrip). + EXPECT_EQ(memcmp(reserializedVerifier, FuzzedSerializedVerifierArray, kSpake2p_VerifierSerialized_Length), 0); +} + +FUZZ_TEST(FuzzPASE_PW, Spake2pVerifier_Serialize_RoundTrip) + .WithDomains(Arbitrary>().WithSize(kSpake2p_VerifierSerialized_Length)); + +/* -------------------------------------------------------------------------------------------*/ +// In This Test a Fuzzed PBKDFParamRequest Message is fuzzed, which is then injected into a PASE Session to test the behaviour of +// PASESession::HandlePBKDFParamRequest(); which will be called by the Accessory/Commissionee. +void TestPASESession::FuzzHandlePBKDFParamRequest(vector fuzzPBKDFLocalRandomData, uint32_t fuzzInitiatorSessionId, + bool fuzzHavePBKDFParameters) +{ + TemporarySessionManager sessionManager(*this); + + // Commissioner: The Sender of PBKDFParamRequest + PASESession pairingCommissioner; + // Accessory: The Receiver of PBKDFParamRequest + PASESession pairingAccessory; + + /*************************** Preparing Commissioner ***************************/ + + CallAllocateSecureSession(sessionManager, pairingCommissioner); + + ReliableMessageProtocolConfig LocalMRPConfig(System::Clock::Milliseconds32(100), System::Clock::Milliseconds32(200), + System::Clock::Milliseconds16(4000)); + + // After the Accessory Handles PBKDFParamRequest, it will send a PBKDFParamResponse back to pairingCommissioner, which should be + // expecting it. + pairingCommissioner.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PBKDFParamResponse); + + /**************************Constructing PBKDFParamRequest Message***************************************** */ + + const size_t max_msg_len = TLV::EstimateStructOverhead(fuzzPBKDFLocalRandomData.size(), // initiatorRandom, + sizeof(fuzzInitiatorSessionId), // initiatorSessionId + sizeof(PasscodeId), // passcodeId, + sizeof(bool), // hasPBKDFParameters + SessionParameters::kEstimatedTLVSize // Session Parameters + ); + + System::PacketBufferHandle req = System::PacketBufferHandle::New(max_msg_len); + EXPECT_FALSE(req.IsNull()); + + System::PacketBufferTLVWriter tlvWriter; + tlvWriter.Init(std::move(req)); + + TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, + tlvWriter.PutBytes(TLV::ContextTag(1), fuzzPBKDFLocalRandomData.data(), fuzzPBKDFLocalRandomData.size())); + + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(2), fuzzInitiatorSessionId)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(3), kDefaultCommissioningPasscodeId)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.PutBoolean(TLV::ContextTag(4), fuzzHavePBKDFParameters)); + + EXPECT_EQ(CHIP_NO_ERROR, PASESession::EncodeSessionParameters(TLV::ContextTag(5), LocalMRPConfig, tlvWriter)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.EndContainer(outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Finalize(&req)); + + /*************************** Preparing Accessory for Receiving PBKDFParamRequest Message ***************************/ + + PASETestLoopbackTransportDelegate delegate; + auto & loopback = GetLoopback(); + loopback.SetLoopbackTransportDelegate(&delegate); + loopback.mSentMessageCount = 0; + + TestSecurePairingDelegate delegateAccessory; + + PayloadHeader payloadHeaderAccessory; + + // One Limitation of using this is that contextAccessory will automatically be an Initiator, while in real-life it should be a + // responder. + ExchangeContext * contextAccessory = NewUnauthenticatedExchangeToBob(&pairingAccessory); + + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest, + &pairingAccessory), + CHIP_NO_ERROR); + + // Adding PASESession::Init in order to AllocateSecureSession and have a localsessionID generated for pairingAccessory + pairingAccessory.Init(sessionManager, 0, &delegateAccessory); + + // This was done to have an exchange context + pairingAccessory.mExchangeCtxt.Emplace(*contextAccessory); + + pairingAccessory.mLocalMRPConfig = MakeOptional(LocalMRPConfig); + + payloadHeaderAccessory.SetMessageType(Protocols::SecureChannel::MsgType::PBKDFParamRequest); + pairingAccessory.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PBKDFParamRequest); + + pairingAccessory.OnMessageReceived(&pairingAccessory.mExchangeCtxt.Value().Get(), payloadHeaderAccessory, std::move(req)); + + DrainAndServiceIO(); +} + +void HandlePBKDFParamRequest(vector fuzzPBKDFLocalRandomData, uint32_t fuzzInitiatorSessionId, + bool fuzzHavePBKDFParameters) +{ + // TODO: #35369 Move this to a Fixture once Errors related to FuzzTest Fixtures are resolved + TestPASESession PASELoopBack; + PASELoopBack.FuzzHandlePBKDFParamRequest(fuzzPBKDFLocalRandomData, fuzzInitiatorSessionId, fuzzHavePBKDFParameters); +} + +FUZZ_TEST(FuzzPASE_PW, HandlePBKDFParamRequest) + .WithDomains( + // PBKDFLocalRandomData + Arbitrary>(), + // InitiatorSessionId + Arbitrary(), + // mHavePBKDFParameters + Arbitrary()); + +/* -------------------------------------------------------------------------------------------*/ +// In This Test a Fuzzed PBKDFParamResponse Message is fuzzed, which is then injected into a PASE Session to test the behaviour of +// PASESession::HandlePBKDFParamResponse(); which will be called by the Commissioner. +void TestPASESession::FuzzHandlePBKDFParamResponse(vector fuzzPBKDFLocalRandomDataInitiator, + vector fuzzPBKDFLocalRandomDataResponder, + uint32_t fuzzResponderSessionId, const vector & fuzzedSalt, + uint32_t fuzzedPBKDF2Iter, bool fuzzHavePBKDFParameters) +{ + TemporarySessionManager sessionManager(*this); + + // Commissioner: The Receiver of PBKDFParamResponse + PASESession pairingCommissioner; + // Accessory: The Sender of PBKDFParamResponse + PASESession pairingAccessory; + + /*************************** Preparing Commissioner ***************************/ + + CallAllocateSecureSession(sessionManager, pairingCommissioner); + + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); + + // This was done to have an exchange context + pairingCommissioner.mExchangeCtxt.Emplace(*contextCommissioner); + + ReliableMessageProtocolConfig LocalMRPConfig(System::Clock::Milliseconds32(100), System::Clock::Milliseconds32(200), + System::Clock::Milliseconds16(4000)); + + pairingCommissioner.mLocalMRPConfig = MakeOptional(LocalMRPConfig); + + // preparing CommissioningHash needed for SetupSpake2p() + pairingCommissioner.mCommissioningHash.Begin(); + pairingCommissioner.mCommissioningHash.AddData(ByteSpan(fuzzedSalt.data(), fuzzedSalt.size())); + + // The Commissioner will check if the PBKDFLocalRandomData it received in TLV is same as the stored mPBKDFLocalRandomData. So we + // inject it here to be able to pass that check + memcpy(&pairingCommissioner.mPBKDFLocalRandomData[0], fuzzPBKDFLocalRandomDataInitiator.data(), + fuzzPBKDFLocalRandomDataInitiator.size()); + + // In order to cover the Code path where the Commissioner has PBKDF Parameters before Starting PASE, as such, the Accessory will + // not send the PBKDF Parameters in the Response message + bool initiatorHasPBKDFParams = fuzzHavePBKDFParameters; + pairingCommissioner.mHavePBKDFParameters = fuzzHavePBKDFParameters; + + /**************************Constructing PBKDFParamResponse Message***************************************** */ + + const size_t max_msg_len = + TLV::EstimateStructOverhead(fuzzPBKDFLocalRandomDataInitiator.size(), // initiatorRandom + fuzzPBKDFLocalRandomDataResponder.size(), // responderRandom + sizeof(fuzzResponderSessionId), // responderSessionId + TLV::EstimateStructOverhead(sizeof(fuzzedPBKDF2Iter), fuzzedSalt.size()), // pbkdf_parameters + SessionParameters::kEstimatedTLVSize // Session Parameters + ); + + System::PacketBufferHandle resp = System::PacketBufferHandle::New(max_msg_len); + EXPECT_FALSE(resp.IsNull()); + + System::PacketBufferTLVWriter tlvWriter; + tlvWriter.Init(std::move(resp)); + + TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType)); + EXPECT_EQ( + CHIP_NO_ERROR, + tlvWriter.PutBytes(TLV::ContextTag(1), fuzzPBKDFLocalRandomDataInitiator.data(), fuzzPBKDFLocalRandomDataInitiator.size())); + EXPECT_EQ( + CHIP_NO_ERROR, + tlvWriter.PutBytes(TLV::ContextTag(2), fuzzPBKDFLocalRandomDataResponder.data(), fuzzPBKDFLocalRandomDataResponder.size())); + + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(3), fuzzResponderSessionId)); + + if (!initiatorHasPBKDFParams) + { + TLV::TLVType pbkdfParamContainer; + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.StartContainer(TLV::ContextTag(4), TLV::kTLVType_Structure, pbkdfParamContainer)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(1), fuzzedPBKDF2Iter)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.PutBytes(TLV::ContextTag(2), fuzzedSalt.data(), fuzzedSalt.size())); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.EndContainer(pbkdfParamContainer)); + } + + EXPECT_EQ(CHIP_NO_ERROR, PASESession::EncodeSessionParameters(TLV::ContextTag(5), LocalMRPConfig, tlvWriter)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.EndContainer(outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Finalize(&resp)); + + /*************************** Preparing Commissioner for Receiving PBKDFParamResponse Message ***************************/ + + PayloadHeader payloadHeaderCommissioner; + + payloadHeaderCommissioner.SetMessageType(Protocols::SecureChannel::MsgType::PBKDFParamResponse); + pairingCommissioner.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PBKDFParamResponse); + + pairingCommissioner.OnMessageReceived(&pairingCommissioner.mExchangeCtxt.Value().Get(), payloadHeaderCommissioner, + std::move(resp)); + + DrainAndServiceIO(); +} + +void HandlePBKDFParamResponse(vector fuzzPBKDFLocalRandomDataInitiator, vector fuzzPBKDFLocalRandomDataResponder, + uint32_t fuzzResponderSessionId, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + bool fuzzHavePBKDFParameters) +{ + // TODO: #35369 Move this to a Fixture once Errors related to FuzzTest Fixtures are resolved + TestPASESession PASELoopBack; + PASELoopBack.FuzzHandlePBKDFParamResponse(fuzzPBKDFLocalRandomDataInitiator, fuzzPBKDFLocalRandomDataResponder, + fuzzResponderSessionId, fuzzedSalt, fuzzedPBKDF2Iter, fuzzHavePBKDFParameters); +} + +FUZZ_TEST(FuzzPASE_PW, HandlePBKDFParamResponse) + .WithDomains( + // fuzzPBKDFLocalRandomDataInitiator + Arbitrary>().WithMaxSize(32), + // fuzzPBKDFLocalRandomDataResponder + Arbitrary>(), + // fuzzResponderSessionId + Arbitrary(), + // fuzzedSalt + Arbitrary>(), + // fuzzedPBKDF2Iter + Arbitrary(), + // mHavePBKDFParameters + Arbitrary()); + +/*------------------------------------------------------------------------------------------------------------------------------------*/ +// In This Test we start by constructing a Fuzzed Pake1 Message, by fuzzing the payload pA. the Fuzzed Pake1 Message is then +// injected into a PASE Session to test the behaviour of PASESession::HandleMsg1_and_SendMsg2(); which will be called by the +// Accessory/Commissionee. +void TestPASESession::FuzzHandlePake1(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, + uint32_t fuzzedPBKDF2Iter, const vector & fuzzed_pA) +{ + + ByteSpan fuzzedSaltSpan(fuzzedSalt.data(), fuzzedSalt.size()); + + TemporarySessionManager sessionManager(*this); + + // Commissioner: The Sender of PAKE1 + PASESession pairingCommissioner; + // Accessory: The Receiver of PAKE1 + PASESession pairingAccessory; + + /*************************** Preparing Commissioner ***************************/ + + // preparing CommissioningHash needed for SetupSpake2p() + pairingCommissioner.mCommissioningHash.Begin(); + pairingCommissioner.mCommissioningHash.AddData(fuzzedSaltSpan); + EXPECT_EQ(CHIP_NO_ERROR, pairingCommissioner.SetupSpake2p()); + + uint8_t serializedWS[kSpake2p_WS_Length * 2] = { 0 }; + + // Compute serializedWS, to be used in BeginProver() + + Spake2pVerifier::ComputeWS(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode, serializedWS, sizeof(serializedWS)); + + EXPECT_EQ(CHIP_NO_ERROR, + pairingCommissioner.mSpake2p.BeginProver(nullptr, 0, nullptr, 0, &serializedWS[0], kSpake2p_WS_Length, + &serializedWS[kSpake2p_WS_Length], kSpake2p_WS_Length)); + + /*********************** Constructing Fuzzed Pake1 Message, to later inject it into PASE Session *********************/ + + constexpr uint8_t kPake1_pA = 1; + + const size_t max_msg_len = TLV::EstimateStructOverhead(fuzzed_pA.size()); + System::PacketBufferHandle msg = System::PacketBufferHandle::New(max_msg_len); + EXPECT_FALSE(msg.IsNull()); + + System::PacketBufferTLVWriter tlvWriter; + tlvWriter.Init(std::move(msg)); + + TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(kPake1_pA), ByteSpan(fuzzed_pA.data(), fuzzed_pA.size()))); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.EndContainer(outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Finalize(&msg)); + + /*************************** Preparing Accessory for Receiving Pake1 Message ***************************/ + + // One Limitation of using this is that contextAccessory will automatically be an Initiator, while in real-life it should be a + // responder. + ExchangeContext * contextAccessory = NewUnauthenticatedExchangeToBob(&pairingAccessory); + + pairingAccessory.mExchangeCtxt.Emplace(*contextAccessory); + + pairingAccessory.mLocalMRPConfig = MakeOptional(ReliableMessageProtocolConfig( + System::Clock::Milliseconds32(100), System::Clock::Milliseconds32(200), System::Clock::Milliseconds16(4000))); + + // preparing CommissioningHash needed for SetupSpake2p() + pairingAccessory.mCommissioningHash.Begin(); + pairingAccessory.mCommissioningHash.AddData(fuzzedSaltSpan); + EXPECT_EQ(CHIP_NO_ERROR, pairingAccessory.SetupSpake2p()); + + // Compute mPASEVerifier (in order for mSpake2p.BeginVerifier() to use it, once it is called by the pairingAccessory through + // HandleMsg1_and_SendMsg2) + pairingAccessory.mPASEVerifier.Generate(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); + + /************************Injecting Fuzzed Pake1 Message into PaseSession::OnMessageReceived*************************/ + + PayloadHeader payloadHeaderAccessory; + + // Below two lines are needed to trigger PASESession::OnMessageReceived to call HandleMsg1_and_SendMsg2 + payloadHeaderAccessory.SetMessageType(Protocols::SecureChannel::MsgType::PASE_Pake1); + pairingAccessory.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PASE_Pake1); + + pairingAccessory.OnMessageReceived(&pairingAccessory.mExchangeCtxt.Value().Get(), payloadHeaderAccessory, std::move(msg)); + + DrainAndServiceIO(); +} + +void HandlePake1(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + const vector & fuzzed_pA) +{ + // TODO: #35369 Move this to a Fixture once Errors related to FuzzTest Fixtures are resolved + TestPASESession PASELoopBack; + + // pA is an uncompressed public key format, it should start with 0x04. + // Appending 0x04 to the fuzzed input to increase the likelihood of having a valid point format during fuzzing. + vector pA_appended = { 0x04 }; + pA_appended.insert(pA_appended.end(), fuzzed_pA.begin(), fuzzed_pA.end()); + PASELoopBack.FuzzHandlePake1(fuzzedSetupPasscode, fuzzedSalt, fuzzedPBKDF2Iter, pA_appended); +} + +// In This FuzzTest, we will construct a PAKE1 Message with a fuzzed TLV length, and send it through a PASESession +FUZZ_TEST(FuzzPASE_PW, HandlePake1) + .WithDomains( + // Setup Code Range (covers the full 27-bit range, plus 16 additional values) + InRange(00000000, 0x800000F), + // Salt length range (extending min and max by 4 bytes) + Arbitrary>() + .WithMinSize(kSpake2p_Min_PBKDF_Salt_Length - 4) + .WithMaxSize(kSpake2p_Max_PBKDF_Salt_Length + 4), + // PBKDF2Iterations count range (extending min and max by 10 iterations) + InRange(kSpake2p_Min_PBKDF_Iterations - 10, kSpake2p_Max_PBKDF_Iterations + 10), + // Fuzzed pA (Original size = kMAX_Point_Length) + Arbitrary>()); + +/*------------------------------------------------------------------------------------------------------------------------------------*/ +// In this FuzzTest we start by constructing a Fuzzed PAKE2 Message, by fuzzing the payloads pB and cB. the fuzzed message is then +// injected into a PASE Session to test the behavior of PASESession::HandleMsg2_and_SendMsg3(), which will be called by Commissioner +void TestPASESession::FuzzHandlePake2(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, + uint32_t fuzzedPBKDF2Iter, const vector & fuzzed_pB, + const vector & fuzzed_cB) +{ + + ByteSpan fuzzedSaltSpan(fuzzedSalt.data(), fuzzedSalt.size()); + + TemporarySessionManager sessionManager(*this); + + // Commissioner: The Receiver of PAKE2 + PASESession pairingCommissioner; + // Accessory: The Sender of PAKE2 + PASESession pairingAccessory; + + /*************************** Preparing Commissioner ***************************/ + + CallAllocateSecureSession(sessionManager, pairingCommissioner); + + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); + + // This was done to have an exchange context + pairingCommissioner.mExchangeCtxt.Emplace(*contextCommissioner); + + pairingCommissioner.mLocalMRPConfig = MakeOptional(ReliableMessageProtocolConfig( + System::Clock::Milliseconds32(100), System::Clock::Milliseconds32(200), System::Clock::Milliseconds16(4000))); + + // preparing CommissioningHash needed for SetupSpake2p() + pairingCommissioner.mCommissioningHash.Begin(); + pairingCommissioner.mCommissioningHash.AddData(fuzzedSaltSpan); + EXPECT_EQ(CHIP_NO_ERROR, pairingCommissioner.SetupSpake2p()); + + uint8_t serializedWS[kSpake2p_WS_Length * 2] = { 0 }; + + // Compute serializedWS, to be used in BeginProver() + Spake2pVerifier::ComputeWS(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode, serializedWS, sizeof(serializedWS)); + + EXPECT_EQ(CHIP_NO_ERROR, + pairingCommissioner.mSpake2p.BeginProver(nullptr, 0, nullptr, 0, &serializedWS[0], kSpake2p_WS_Length, + &serializedWS[kSpake2p_WS_Length], kSpake2p_WS_Length)); + + // The Commissioner should have alread called ComputeRoundOne As part of the PASE Session Exchange (and consequently have + // mSpake2p.state = CHIP_SPAKE2P_STATE::R1), the computed values are not used in the test. + uint8_t X[kMAX_Point_Length]; + size_t X_len = sizeof(X); + pairingCommissioner.mSpake2p.ComputeRoundOne(nullptr, 0, X, &X_len); + + /*************************** Preparing Accessory ***************************/ + + // Init mCommissioningHash; needed for SetupSpake2p() + pairingAccessory.mCommissioningHash.Begin(); + pairingAccessory.mCommissioningHash.AddData(fuzzedSaltSpan); + EXPECT_EQ(CHIP_NO_ERROR, pairingAccessory.SetupSpake2p()); + + // Below Steps take place in HandleMsg1 + // Compute mPASEVerifier to be able to pass it to BeginVerifier() + pairingAccessory.mPASEVerifier.Generate(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); + + pairingAccessory.mSpake2p.BeginVerifier(nullptr, 0, nullptr, 0, pairingAccessory.mPASEVerifier.mW0, kP256_FE_Length, + pairingAccessory.mPASEVerifier.mL, kP256_Point_Length); + + /*********************** Constructing Fuzzed PAKE2 Message, to later inject it into PASE Session *********************/ + + constexpr uint8_t kPake2_pB = 1; + constexpr uint8_t kPake2_cB = 2; + + const size_t max_msg_len = TLV::EstimateStructOverhead(fuzzed_pB.size(), fuzzed_cB.size()); + System::PacketBufferHandle msg2 = System::PacketBufferHandle::New(max_msg_len); + EXPECT_FALSE(msg2.IsNull()); + + System::PacketBufferTLVWriter tlvWriter; + tlvWriter.Init(std::move(msg2)); + + TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(kPake2_pB), ByteSpan(fuzzed_pB.data(), fuzzed_pB.size()))); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(kPake2_cB), ByteSpan(fuzzed_cB.data(), fuzzed_cB.size()))); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.EndContainer(outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Finalize(&msg2)); + + // After PAKE2 is sent, the pairingAccessory will expect a a Pake3 Message + pairingAccessory.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PASE_Pake3); + + /************************Injecting Fuzzed PAKE2 Message into PaseSession::OnMessageReceived*************************/ + + PayloadHeader payloadHeaderCommissioner; + + // Below two lines are needed to trigger PASESession::OnMessageReceived to call HandleMsg2_and_SendMsg3 + payloadHeaderCommissioner.SetMessageType(Protocols::SecureChannel::MsgType::PASE_Pake2); + pairingCommissioner.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PASE_Pake2); + + pairingCommissioner.OnMessageReceived(&pairingCommissioner.mExchangeCtxt.Value().Get(), payloadHeaderCommissioner, + std::move(msg2)); + + DrainAndServiceIO(); +} + +void HandlePake2(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + const vector & pB, const vector & cB) +{ + TestPASESession PASELoopBack; + // pB is an uncompressed public key format, it should start with 0x04. + // Appending 0x04 to the fuzzed input to increase the likelihood of having a valid point format during fuzzing. + vector pB_appended = { 0x04 }; + pB_appended.insert(pB_appended.end(), pB.begin(), pB.end()); + + PASELoopBack.FuzzHandlePake2(fuzzedSetupPasscode, fuzzedSalt, fuzzedPBKDF2Iter, pB_appended, cB); +} + +FUZZ_TEST(FuzzPASE_PW, HandlePake2) + .WithDomains( + // Setup Code Range (covers the full 27-bit range, plus 16 additional values) + InRange(00000000, 0x800000F), + // Salt length range (extending min and max by 4 bytes) + Arbitrary>() + .WithMinSize(kSpake2p_Min_PBKDF_Salt_Length - 4) + .WithMaxSize(kSpake2p_Max_PBKDF_Salt_Length + 4), + // PBKDF2Iterations count range (extending min and max by 10 iterations) + InRange(kSpake2p_Min_PBKDF_Iterations - 10, kSpake2p_Max_PBKDF_Iterations + 10), + // Fuzzed pB (Original size = kMAX_Point_Length), + Arbitrary>(), + // Fuzzed cB (Original size = kMAX_Hash_Length) + Arbitrary>()); + +/*------------------------------------------------------------------------------------------------------------------------------------*/ +// In This Test we start by constructing a Fuzzed Pake3 Message, by fuzzing the payload cA. The Fuzzed message is then injected into +// a PASE Session to test the behavior of PASESession::HandleMsg3(); which will be called by the Accessory/Commissionee. +void TestPASESession::FuzzHandlePake3(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, + uint32_t fuzzedPBKDF2Iter, const vector & fuzzed_cA) +{ + + ByteSpan fuzzedSaltSpan(fuzzedSalt.data(), fuzzedSalt.size()); + + TemporarySessionManager sessionManager(*this); + + // Commissioner: The Sender of PAKE3 + PASESession pairingCommissioner; + // Accessory: The Receiver of PAKE3 + PASESession pairingAccessory; + + /*************************** Preparing Commissioner ***************************/ + + // preparing CommissioningHash needed for SetupSpake2p() + pairingCommissioner.mCommissioningHash.Begin(); + pairingCommissioner.mCommissioningHash.AddData(fuzzedSaltSpan); + EXPECT_EQ(CHIP_NO_ERROR, pairingCommissioner.SetupSpake2p()); + + uint8_t serializedWS[kSpake2p_WS_Length * 2] = { 0 }; + + // Compute serializedWS, to be used in BeginProver() + + Spake2pVerifier::ComputeWS(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode, serializedWS, sizeof(serializedWS)); + + EXPECT_EQ(CHIP_NO_ERROR, + pairingCommissioner.mSpake2p.BeginProver(nullptr, 0, nullptr, 0, &serializedWS[0], kSpake2p_WS_Length, + &serializedWS[kSpake2p_WS_Length], kSpake2p_WS_Length)); + + // The Commissioner should have already called ComputeRoundOne As part of the Exchange (and consequently have state = + // CHIP_SPAKE2P_STATE::R1), the computed values are not used. + uint8_t X[kMAX_Point_Length]; + size_t X_len = sizeof(X); + pairingCommissioner.mSpake2p.ComputeRoundOne(nullptr, 0, X, &X_len); + + /*************************** Preparing Accessory ***************************/ + + CallAllocateSecureSession(sessionManager, pairingAccessory); + + // One Limitation of using this is that contextAccessory will automatically be an Initiator, while in real-life it should be a + // responder. + ExchangeContext * contextAccessory = NewUnauthenticatedExchangeToBob(&pairingAccessory); + + // This was done to have an exchange context + pairingAccessory.mExchangeCtxt.Emplace(*contextAccessory); + + pairingAccessory.mLocalMRPConfig = MakeOptional(ReliableMessageProtocolConfig( + System::Clock::Milliseconds32(100), System::Clock::Milliseconds32(200), System::Clock::Milliseconds16(4000))); + + // preparing CommissioningHash needed for SetupSpake2p() + pairingAccessory.mCommissioningHash.Begin(); + pairingAccessory.mCommissioningHash.AddData(fuzzedSaltSpan); + EXPECT_EQ(CHIP_NO_ERROR, pairingAccessory.SetupSpake2p()); + + // Below Steps take place in HandleMsg1 + // compute mPASEVerifier to be able to pass it to BeginVerifier() + pairingAccessory.mPASEVerifier.Generate(fuzzedPBKDF2Iter, fuzzedSaltSpan, fuzzedSetupPasscode); + + pairingAccessory.mSpake2p.BeginVerifier(nullptr, 0, nullptr, 0, pairingAccessory.mPASEVerifier.mW0, kP256_FE_Length, + pairingAccessory.mPASEVerifier.mL, kP256_Point_Length); + + /*************************** Preparing Accessory for Receiving PAKE3 Message ***************************/ + + uint8_t Y[kMAX_Point_Length]; + size_t Y_len = sizeof(Y); + + uint8_t verifier[kMAX_Hash_Length]; + size_t verifier_len = kMAX_Hash_Length; + + // These calls are usually done on the Accessory before sending Pake2. They are needed to make sure that the Accessory is at the + // correct Spake2p state (CHIP_SPAKE2P_STATE::R2) to handle Pake3 Messages. + pairingAccessory.mSpake2p.ComputeRoundOne(X, X_len, Y, &Y_len); + pairingAccessory.mSpake2p.ComputeRoundTwo(X, X_len, verifier, &verifier_len); + + /*********************** Constructing Fuzzed PAKE3 Message, to later inject it into PASE Session *********************/ + + constexpr uint8_t kPake3_cA = 1; + + const size_t max_msg_len = TLV::EstimateStructOverhead(fuzzed_cA.size()); + System::PacketBufferHandle msg3 = System::PacketBufferHandle::New(max_msg_len); + EXPECT_FALSE(msg3.IsNull()); + + System::PacketBufferTLVWriter tlvWriter; + tlvWriter.Init(std::move(msg3)); + + TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Put(TLV::ContextTag(kPake3_cA), ByteSpan(fuzzed_cA.data(), fuzzed_cA.size()))); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.EndContainer(outerContainerType)); + EXPECT_EQ(CHIP_NO_ERROR, tlvWriter.Finalize(&msg3)); + + // After PAKE3 is sent, the pairingCommissioner will expect a StatusReport + pairingCommissioner.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::StatusReport); + + /************************Injecting Fuzzed PAKE3 Message into PaseSession::OnMessageReceived*************************/ + + PayloadHeader payloadHeaderAccessory; + + // Below two lines are needed to trigger PASESession::OnMessageReceived to call HandleMsg3 + payloadHeaderAccessory.SetMessageType(Protocols::SecureChannel::MsgType::PASE_Pake3); + pairingAccessory.mNextExpectedMsg.SetValue(Protocols::SecureChannel::MsgType::PASE_Pake3); + + pairingAccessory.OnMessageReceived(&pairingAccessory.mExchangeCtxt.Value().Get(), payloadHeaderAccessory, std::move(msg3)); + + DrainAndServiceIO(); +} + +void HandlePake3(const uint32_t fuzzedSetupPasscode, const vector & fuzzedSalt, uint32_t fuzzedPBKDF2Iter, + const vector & fuzzedcA) +{ + TestPASESession PASELoopBack; + PASELoopBack.FuzzHandlePake3(fuzzedSetupPasscode, fuzzedSalt, fuzzedPBKDF2Iter, fuzzedcA); +} + +FUZZ_TEST(FuzzPASE_PW, HandlePake3) + .WithDomains( + // Setup Code Range (covers the full 27-bit range, plus 16 additional values) + InRange(00000000, 0x800000F), + // Salt length range (extending min and max by 4 bytes) + Arbitrary>() + .WithMinSize(kSpake2p_Min_PBKDF_Salt_Length - 4) + .WithMaxSize(kSpake2p_Max_PBKDF_Salt_Length + 4), + // PBKDF2Iterations count range (extending min and max by 10 iterations) + InRange(kSpake2p_Min_PBKDF_Iterations - 10, kSpake2p_Max_PBKDF_Iterations + 10), + // Fuzzed cA (Original size = kMAX_Hash_Length) + Arbitrary>()); + +} // namespace Testing +} // namespace chip diff --git a/src/pw_backends/assert/BUILD.gn b/src/pw_backends/assert/BUILD.gn new file mode 100644 index 0000000000..5da1b7836b --- /dev/null +++ b/src/pw_backends/assert/BUILD.gn @@ -0,0 +1,69 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +import("$dir_pw_build/facade.gni") + +config("public_include_path") { + include_dirs = [ "public" ] + visibility = [ ":*" ] +} + +config("backend_config") { + include_dirs = [ "public_overrides" ] + visibility = [ ":*" ] +} + +pw_facade("handler") { + backend = "${chip_root}/src/pw_backends/assert:assert.impl" + public_configs = [ ":public_include_path" ] + public_deps = [ "$dir_pw_preprocessor" ] + public = [ "public/pw_assert_matter/handler.h" ] +} + +pw_source_set("assert") { + public_configs = [ + ":backend_config", + ":public_include_path", + ] + public = [ + "public/pw_assert_matter/handler.h", + "public_overrides/pw_assert_backend/check_backend.h", + ] + public_deps = [ ":handler.facade" ] +} + +# A basic handler backend using pw_sys_io. +pw_source_set("assert.impl") { + # Turn off GN check since this target intentionally leaves out deps to avoid + # circular dependencies. + check_includes = false + + configs = [ + "$dir_pw_string:public_include_path", + "$dir_pw_result:public_include_path", + ] + + deps = [ + ":handler.facade", + "$dir_pw_assert:config", + "$dir_pw_preprocessor", + "$dir_pw_string:builder", + "${chip_root}/src/lib/support", + ] + sources = [ "handler.cpp" ] +} diff --git a/src/pw_backends/assert/handler.cpp b/src/pw_backends/assert/handler.cpp new file mode 100644 index 0000000000..b776cb892d --- /dev/null +++ b/src/pw_backends/assert/handler.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +#include +#include +#include + +void pw_assert_matter_HandleFailure(const char * file_name, int line_number, const char * function_name, const char * format, ...) +{ + + pw::StringBuffer<64> builder; + + builder.Format("Assertion failed: %s:%d (in %s):", file_name, line_number, function_name); + + va_list args; + va_start(args, format); + builder.FormatVaList(format, args); + va_end(args); + + ChipLogError(Support, "%s", builder.c_str()); + chipDie(); +} + +extern "C" void pw_assert_HandleFailure(void) +{ + pw_assert_matter_HandleFailure("", -1, "", "Crash: PW_ASSERT() or PW_DASSERT() failure"); +} diff --git a/src/pw_backends/assert/public/pw_assert_matter/handler.h b/src/pw_backends/assert/public/pw_assert_matter/handler.h new file mode 100644 index 0000000000..efeac9a1c7 --- /dev/null +++ b/src/pw_backends/assert/public/pw_assert_matter/handler.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "pw_preprocessor/compiler.h" +#include "pw_preprocessor/util.h" + +PW_EXTERN_C_START + +// Application-defined assert failure handler for pw_assert_basic. +// file_name - may be nullptr if not available +// line_number - may be -1 if not available +// function_name - may be nullptr if not available +// format & varags - The assert reason can be built using the format string and +// the varargs. +// +// Applications must define this function; it is not defined by pw_assert_basic. +void pw_assert_matter_HandleFailure(const char * file_name, int line_number, const char * function_name, const char * format, ...) + PW_PRINTF_FORMAT(4, 5) PW_NO_RETURN; + +PW_EXTERN_C_END diff --git a/src/pw_backends/assert/public_overrides/pw_assert_backend/check_backend.h b/src/pw_backends/assert/public_overrides/pw_assert_backend/check_backend.h new file mode 100644 index 0000000000..af6c76aa0d --- /dev/null +++ b/src/pw_backends/assert/public_overrides/pw_assert_backend/check_backend.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "pw_assert_matter/handler.h" + +// Use __PRETTY_FUNCTION__, a GNU extension, in place of the __func__ macro when +// supported. __PRETTY_FUNCTION__ expands to the full C++ function name. +#ifdef __GNUC__ +#define _PW_ASSERT_MATTER_FUNCTION_NAME __PRETTY_FUNCTION__ +#else +#define _PW_ASSERT_MATTER_FUNCTION_NAME __func__ +#endif // __GNUC__ + +// Die with a message with many attributes included. This is the crash macro +// frontend that funnels everything into the C handler provided by the user, +// pw_assert_MATTER_HandleFailure(). +#define PW_HANDLE_CRASH(...) \ + pw_assert_matter_HandleFailure(__FILE__, __LINE__, _PW_ASSERT_MATTER_FUNCTION_NAME PW_COMMA_ARGS(__VA_ARGS__)) + +// Die with a message with many attributes included. This is the crash macro +// frontend that funnels everything into the C handler provided by the user, +// pw_assert_matter_HandleFailure(). +#define PW_HANDLE_ASSERT_FAILURE(condition_string, message, ...) \ + pw_assert_matter_HandleFailure(__FILE__, __LINE__, _PW_ASSERT_MATTER_FUNCTION_NAME, \ + "Check failed: " condition_string ". " message PW_COMMA_ARGS(__VA_ARGS__)) + +// Sample assert failure message produced by the below implementation: +// +// Check failed: current_sensor (=610) < new_sensor (=50). More details! +// +// Putting the value next to the operand makes the string easier to read. + +// clang-format off +// This is too hairy for clang format to handle and retain readability. +#define PW_HANDLE_ASSERT_BINARY_COMPARE_FAILURE(arg_a_str, \ + arg_a_val, \ + comparison_op_str, \ + arg_b_str, \ + arg_b_val, \ + type_fmt, \ + message, ...) \ + pw_assert_matter_HandleFailure( \ + __FILE__, \ + __LINE__, \ + _PW_ASSERT_MATTER_FUNCTION_NAME, \ + "Check failed: " \ + arg_a_str " (=" type_fmt ") " \ + comparison_op_str " " \ + arg_b_str " (=" type_fmt ")" \ + ". " message, \ + arg_a_val, arg_b_val PW_COMMA_ARGS(__VA_ARGS__)) diff --git a/src/pw_backends/log/BUILD.gn b/src/pw_backends/log/BUILD.gn new file mode 100644 index 0000000000..b935a68650 --- /dev/null +++ b/src/pw_backends/log/BUILD.gn @@ -0,0 +1,75 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +import("$dir_pw_build/facade.gni") + +config("public_include_path") { + include_dirs = [ "public" ] + visibility = [ ":*" ] +} + +config("backend_config") { + include_dirs = [ "public_overrides" ] + visibility = [ ":*" ] +} + +pw_facade("handler") { + backend = "${chip_root}/src/pw_backends/log:log.impl" + public_configs = [ ":public_include_path" ] + public_deps = [ + "$dir_pw_preprocessor", + "${chip_root}/src/lib/support:text_only_logging", + ] + public = [ + "public/pw_log_matter/log_matter.h", + "public_overrides/pw_log_backend/log_backend.h", + ] +} + +pw_source_set("log") { + public_configs = [ + ":backend_config", + ":public_include_path", + ] + public = [ "public/pw_log_matter/log_matter.h" ] + public_deps = [ + ":handler.facade", + "${chip_root}/src/lib/support:text_only_logging", + ] +} + +# A basic handler backend using pw_sys_io. +pw_source_set("log.impl") { + # Turn off GN check since this target intentionally leaves out deps to avoid + # circular dependencies. + check_includes = false + + configs = [ + "$dir_pw_string:public_include_path", + "$dir_pw_result:public_include_path", + ] + + deps = [ + ":handler.facade", + "$dir_pw_log:config", + "$dir_pw_preprocessor", + "$dir_pw_string:builder", + "${chip_root}/src/lib/support", + ] + sources = [] +} diff --git a/src/pw_backends/log/public/pw_log_matter/log_matter.h b/src/pw_backends/log/public/pw_log_matter/log_matter.h new file mode 100644 index 0000000000..c956bcadb7 --- /dev/null +++ b/src/pw_backends/log/public/pw_log_matter/log_matter.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "lib/support/logging/Constants.h" +#include +#include + +// Pigweed defines more granular logging than CHIP. +// we match the following: +// - Detail == DEBUG +// - Progress == INFO +// - ERROR = WARN, ERROR, CRITICAL + +constexpr chip::Logging::LogCategory PwLogLevelToChipLogCategory(int level) +{ + switch (level) + { + case PW_LOG_LEVEL_DEBUG: + return chip::Logging::kLogCategory_Detail; + case PW_LOG_LEVEL_INFO: + return chip::Logging::kLogCategory_Progress; + default: + return chip::Logging::kLogCategory_Error; + } +} + +#define PW_LOG_DEBUG(...) ChipLogDetail(NotSpecified, __VA_ARGS__) +#define PW_LOG_INFO(...) ChipLogProgress(NotSpecified, __VA_ARGS__) +#define PW_LOG_WARN(...) ChipLogError(NotSpecified, __VA_ARGS__) +#define PW_LOG_ERROR(...) ChipLogError(NotSpecified, __VA_ARGS__) +#define PW_LOG_CRITICAL(...) ChipLogError(NotSpecified, __VA_ARGS__) + +// Log a message with many attributes included. +// +// This is the main macro that functions not included above will use +#define PW_HANDLE_LOG(level, module, flags, message, ...) \ + ChipInternalLogImpl(NotSpecified, PwLogLevelToChipLogCategory(level), message, __VA_ARGS__) diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_configuration.h b/src/pw_backends/log/public_overrides/pw_log_backend/log_backend.h similarity index 53% rename from examples/platform/silabs/efr32/wf200/sl_wfx_configuration.h rename to src/pw_backends/log/public_overrides/pw_log_backend/log_backend.h index deb468d1a6..8e9e15947a 100644 --- a/examples/platform/silabs/efr32/wf200/sl_wfx_configuration.h +++ b/src/pw_backends/log/public_overrides/pw_log_backend/log_backend.h @@ -1,12 +1,12 @@ /* - * - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -14,17 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #pragma once -// SL_WFX_DEFAULT_REQUEST_TIMEOUT_MS> Timeout period in milliseconds<250-10000> -// Default: 5000 -// Timeout period in milliseconds for requests. -#define SL_WFX_DEFAULT_REQUEST_TIMEOUT_MS (5000) - -// WFx Secure Link configuration - -// SL_WFX_SLK_CURVE25519> Use crypto curves -// Default: 1 -// If this option is enabled ECDH crypto is used, KDF otherwise. -#define SL_WFX_SLK_CURVE25519 (1) +#include "pw_log_matter/log_matter.h" diff --git a/src/python_testing/TC_MCORE_FS_1_5.py b/src/python_testing/TC_MCORE_FS_1_5.py index 59549fd0bc..e8d6b3e678 100755 --- a/src/python_testing/TC_MCORE_FS_1_5.py +++ b/src/python_testing/TC_MCORE_FS_1_5.py @@ -212,7 +212,7 @@ async def test_TC_MCORE_FS_1_5(self): time_remaining = report_waiting_timeout_delay_sec parts_list_endpoint_count_from_step_1 = len(step_1_dut_parts_list) - step_3_dut_parts_list = None + step_3_dut_parts_list = [] while time_remaining > 0: try: item = parts_list_queue.get(block=True, timeout=time_remaining) @@ -304,16 +304,20 @@ async def test_TC_MCORE_FS_1_5(self): endpoint, attribute, value = item['endpoint'], item['attribute'], item['value'] # Record arrival of an expected subscription change when seen - if endpoint == newly_added_endpoint and attribute == Clusters.AdministratorCommissioning.Attributes.WindowStatus: + if endpoint == newly_added_endpoint and attribute == cadmin_attr.WindowStatus: + if value != th_server_direct_cadmin[cadmin_attr.WindowStatus]: + logging.info("Window status is %r, waiting for %r", value, + th_server_direct_cadmin[cadmin_attr.WindowStatus]) + continue cadmin_sub_new_data = True break - except queue.Empty: # No error, we update timeouts and keep going pass - - elapsed = time.time() - start_time - time_remaining = report_waiting_timeout_delay_sec - elapsed + finally: + # each iteration will alter timing + elapsed = time.time() - start_time + time_remaining = report_waiting_timeout_delay_sec - elapsed asserts.assert_true(cadmin_sub_new_data, "Timed out waiting for DUT to reflect AdministratorCommissioning attributes for bridged device") diff --git a/src/python_testing/TC_PWRTL_2_1.py b/src/python_testing/TC_PWRTL_2_1.py index 3de09c6e93..9d4b3de977 100644 --- a/src/python_testing/TC_PWRTL_2_1.py +++ b/src/python_testing/TC_PWRTL_2_1.py @@ -53,30 +53,43 @@ async def test_TC_PWRTL_2_1(self): endpoint = self.user_params.get("endpoint", 1) - self.print_step(1, "Commissioning, already done") + powertop_attr_list = Clusters.Objects.PowerTopology.Attributes.AttributeList + powertop_cluster = Clusters.Objects.PowerTopology + attribute_list = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=powertop_cluster, attribute=powertop_attr_list) + avail_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.ActiveEndpoints.attribute_id + act_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.AvailableEndpoints.attribute_id - if not self.check_pics("PWRTL.S.A0000"): - logging.info("Test skipped because PICS PWRTL.S.A0000 is not set") - return + self.print_step(1, "Commissioning, already done") self.print_step(2, "Read AvailableAttributes attribute") - available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints) + if avail_endpoints_attr_id in attribute_list: + available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints) - asserts.assert_less_equal(len(available_endpoints), 20, - "AvailableEndpoints length %d must be less than 21!" % len(available_endpoints)) + if available_endpoints == []: + logging.info("AvailableEndpoints is an empty list") + else: + logging.info("AvailableEndpoints: %s" % (available_endpoints)) + asserts.assert_less_equal(len(available_endpoints), 20, + "AvailableEndpoints length %d must be less than 21!" % len(available_endpoints)) - if not self.check_pics("PWRTL.S.A0001"): - logging.info("Test skipped because PICS PWRTL.S.A0001 is not set") - return + else: + self.mark_current_step_skipped() self.print_step(3, "Read ActiveEndpoints attribute") - active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints) - logging.info("ActiveEndpoints: %s" % (active_endpoints)) - asserts.assert_less_equal(len(active_endpoints), 20, - "ActiveEndpoints length %d must be less than 21!" % len(active_endpoints)) - # Verify that ActiveEndpoints is a subset of AvailableEndpoints - asserts.assert_true(set(active_endpoints).issubset(set(available_endpoints)), - "ActiveEndpoints should be a subset of AvailableEndpoints") + + if act_endpoints_attr_id in attribute_list: + active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints) + logging.info("ActiveEndpoints: %s" % (active_endpoints)) + asserts.assert_less_equal(len(active_endpoints), 20, + "ActiveEndpoints length %d must be less than 21!" % len(active_endpoints)) + + if available_endpoints == []: + # Verify that ActiveEndpoints is a subset of AvailableEndpoints + asserts.assert_true(set(active_endpoints).issubset(set(available_endpoints)), + "ActiveEndpoints should be a subset of AvailableEndpoints") + + else: + self.mark_current_step_skipped() if __name__ == "__main__": diff --git a/src/python_testing/TC_VALCC_4_4.py b/src/python_testing/TC_VALCC_4_4.py index b85ff9a9f0..63cc6170ab 100644 --- a/src/python_testing/TC_VALCC_4_4.py +++ b/src/python_testing/TC_VALCC_4_4.py @@ -172,17 +172,17 @@ async def test_TC_VALCC_4_4(self): pass self.step(11) - utcTime = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) + utcTime2 = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.TimeSynchronization, attribute=Clusters.TimeSynchronization.Attributes.UTCTime) - asserts.assert_true(utcTime is not NullValue, "OpenDuration is null") + asserts.assert_true(utcTime2 is not NullValue, "OpenDuration is null") self.step(12) auto_close_time_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.AutoCloseTime) asserts.assert_true(auto_close_time_dut is not NullValue, "AutoCloseTime is null") - asserts.assert_greater_equal(auto_close_time_dut, (utcTime + ((defaultOpenDuration - 5) * 1000000)), + asserts.assert_greater_equal(auto_close_time_dut, (utcTime2 + ((defaultOpenDuration - 5) * 1000000)), "AutoCloseTime is not in the expected range") - asserts.assert_less_equal(auto_close_time_dut, (utcTime + (defaultOpenDuration * 1000000)), + asserts.assert_less_equal(auto_close_time_dut, (utcTime2 + (defaultOpenDuration * 1000000)), "AutoCloseTime is not in the expected range") self.step(13) diff --git a/src/python_testing/execute_python_tests.py b/src/python_testing/execute_python_tests.py index 34a391873b..c85a02bc40 100644 --- a/src/python_testing/execute_python_tests.py +++ b/src/python_testing/execute_python_tests.py @@ -20,6 +20,8 @@ import os import subprocess +import yaml + # Function to load --app argument environment variables from a file @@ -36,11 +38,8 @@ def load_env_from_yaml(file_path): Args: file_path (str): The path to the YAML file containing the environment variables. """ - with open(file_path, 'r') as file: - for line in file: - if line.strip(): # Skip empty lines - key, value = line.strip().split(': ', 1) - os.environ[key] = value + for key, value in yaml.full_load(open(file_path, 'r')).items(): + os.environ[key] = value def main(search_directory, env_file): @@ -53,38 +52,8 @@ def main(search_directory, env_file): # Define the base command to run tests base_command = os.path.join(chip_root, "scripts/tests/run_python_test.py") - # Define the test python script files and patterns to exclude - excluded_patterns = { - "MinimalRepresentation.py", # Code/Test not being used or not shared code for any other tests - "TC_CNET_4_4.py", # It has no CI execution block, is not executed in CI - "TC_DGGEN_3_2.py", # src/python_testing/test_testing/test_TC_DGGEN_3_2.py is the Unit test of this test - "TC_EEVSE_Utils.py", # Shared code for TC_EEVSE, not a standalone test - "TC_EWATERHTRBase.py", # Shared code for TC_EWATERHTR, not a standalone test - "TC_EnergyReporting_Utils.py", # Shared code for TC_EEM and TC_EPM, not a standalone test - "TC_OpstateCommon.py", # Shared code for TC_OPSTATE, not a standalone test - "TC_pics_checker.py", # Currently isn't enabled because we don't have any examples with conformant PICS - "TC_TMP_2_1.py", # src/python_testing/test_testing/test_TC_TMP_2_1.py is the Unit test of this test - "TC_OCC_3_1.py", # There are CI issues for the test cases that implements manually controlling sensor device for the occupancy state ON/OFF change - "TC_OCC_3_2.py", # There are CI issues for the test cases that implements manually controlling sensor device for the occupancy state ON/OFF change - "TestCommissioningTimeSync.py", # Code/Test not being used or not shared code for any other tests - "TestConformanceSupport.py", # Unit test - does not run against an app - "TestChoiceConformanceSupport.py", # Unit test - does not run against an app - "TC_DEMTestBase.py", # Shared code for TC_DEM, not a standalone test - "TestConformanceTest.py", # Unit test of the conformance test (TC_DeviceConformance) - does not run against an app - "TestIdChecks.py", # Unit test - does not run against an app - "TestSpecParsingDeviceType.py", # Unit test - does not run against an app - "TestConformanceTest.py", # Unit test - does not run against an app - "TestMatterTestingSupport.py", # Unit test - does not run against an app - "TestSpecParsingSupport.py", # Unit test - does not run against an app - "TestTimeSyncTrustedTimeSource.py", # Unit test and shared code for scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py - "drlk_2_x_common.py", # Shared code for TC_DRLK, not a standalone test - # Python code that runs all the python tests from src/python_testing (This code itself run via tests.yaml) - "execute_python_tests.py", - "hello_external_runner.py", # Code/Test not being used or not shared code for any other tests - "hello_test.py", # Is a template for tests - "test_plan_support.py", # Shared code for TC_*, not a standalone test - "test_plan_table_generator.py", # Code/Test not being used or not shared code for any other tests - } + metadata = yaml.full_load(open(os.path.join(chip_root, "src/python_testing/test_metadata.yaml"))) + excluded_patterns = set([item["name"] for item in metadata["not_automated"]]) # Get all .py files in the directory all_python_files = glob.glob(os.path.join(search_directory, "*.py")) diff --git a/src/python_testing/matter_testing_infrastructure/chip/testing/tasks.py b/src/python_testing/matter_testing_infrastructure/chip/testing/tasks.py index 39d1be3ec8..01351cb987 100644 --- a/src/python_testing/matter_testing_infrastructure/chip/testing/tasks.py +++ b/src/python_testing/matter_testing_infrastructure/chip/testing/tasks.py @@ -14,10 +14,11 @@ import logging import re +import shlex import subprocess import sys import threading -from typing import BinaryIO, Callable, List, Optional, Union +from typing import BinaryIO, Callable, Optional, Union def forward_f(f_in: BinaryIO, @@ -29,6 +30,8 @@ def forward_f(f_in: BinaryIO, This function can optionally post-process received lines using a callback function. """ + + # NOTE: readlines would block here, so read line by line instead while line := f_in.readline(): if cb is not None: line = cb(line, is_stderr) @@ -39,7 +42,7 @@ def forward_f(f_in: BinaryIO, class Subprocess(threading.Thread): """Run a subprocess in a thread.""" - def __init__(self, program: str, *args: List[str], + def __init__(self, program: str, *args, output_cb: Optional[Callable[[bytes, bool], bytes]] = None, f_stdout: BinaryIO = sys.stdout.buffer, f_stderr: BinaryIO = sys.stderr.buffer): @@ -62,7 +65,7 @@ def __init__(self, program: str, *args: List[str], self.output_cb = output_cb self.f_stdout = f_stdout self.f_stderr = f_stderr - self.output_match = None + self.output_match: Optional[re.Pattern] = None self.returncode = None def _set_output_match(self, pattern: Union[str, re.Pattern]): @@ -81,11 +84,14 @@ def _check_output(self, line: bytes, is_stderr: bool): def run(self): """Thread entry point.""" - logging.info("RUN: %s %s", self.program, " ".join(self.args)) - self.p = subprocess.Popen([self.program] + list(self.args), + command = [self.program] + list(self.args) + + logging.info("RUN: %s", shlex.join(command)) + self.p = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + bufsize=0) self.event_started.set() # Forward stdout and stderr with a tag attached. @@ -123,7 +129,7 @@ def start(self, # hang on the join call in our thread entry point in case of # Python process termination (not-caught exception). self.p.terminate() - raise TimeoutError("Expected output not found") + raise TimeoutError("Expected output '%r' not found within %s seconds" % (expected_output, timeout)) self.expected_output = None def send(self, message: str, end: str = "\n", diff --git a/src/python_testing/matter_testing_infrastructure/generate_data_model_xmls_gni.py b/src/python_testing/matter_testing_infrastructure/generate_data_model_xmls_gni.py new file mode 100644 index 0000000000..76179797f5 --- /dev/null +++ b/src/python_testing/matter_testing_infrastructure/generate_data_model_xmls_gni.py @@ -0,0 +1,112 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Generates a gni file containing all data_model files (generally XML and JSON files) +that are typically used by matter_testing_infrastructure. + +These files are to be bundled with whl packages of the matter_testing_infrastructure +so that methods requiring data model files work just by installing the python +package without requiring a full chip SDK checkout. +""" +import os + +import jinja2 + +# Set chip_root to be dynamically based on the script's location +chip_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../..")) + +# Directories to search for .xml and .json files relative to chip_root +directories = [ + os.path.join(chip_root, "data_model/1.3/clusters/"), + os.path.join(chip_root, "data_model/1.3/device_types/"), + os.path.join(chip_root, "data_model/1.4/clusters/"), + os.path.join(chip_root, "data_model/1.4/device_types/"), + os.path.join(chip_root, "data_model/master/clusters/"), + os.path.join(chip_root, "data_model/master/device_types/"), +] + +# Template for generating the GNI file content with proper indentation +GNI_TEMPLATE = """\ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") + +data_model_XMLS = [ +{% for name in file_list %} + "{{ name }}", +{% endfor %} +] +""" + +# Function to find and collect all .xml and .json files + + +def get_data_model_file_names(): + file_list = [] + for directory in directories: + for root, _, files in os.walk(directory): + for file in files: + if file.endswith(".xml") or file.endswith(".json"): + # Replace absolute path with `${chip_root}` for GNI compatibility + relative_path = os.path.join("${chip_root}", os.path.relpath(root, chip_root), file) + file_list.append(relative_path) + # Sort files alphabetically + file_list.sort() + return file_list + +# Main function to generate the data_model_xmls.gni file + + +def generate_gni_file(): + # Step 1: Find all files and create the sorted file list + file_list = get_data_model_file_names() + + # Step 2: Render the template with the file list + environment = jinja2.Environment(trim_blocks=True, lstrip_blocks=True) + template = environment.from_string(GNI_TEMPLATE) + output_content = template.render(file_list=file_list) + + # Step 3: Dynamically generate the output file path + # Get the script's directory (where this script is located) + script_dir = os.path.dirname(os.path.realpath(__file__)) # Directory of the current script + + # Step 4: Ensure we are in the correct `src/python_testing/` directory + base_dir = os.path.abspath(os.path.join(script_dir, "../..")) # Go up two levels to src/python_testing/ + # Now append `matter_testing_infrastructure` + output_dir = os.path.join(base_dir, "python_testing", "matter_testing_infrastructure") + output_file = os.path.join(output_dir, "data_model_xmls.gni") + + # Step 5: Write the rendered content to the output file + os.makedirs(output_dir, exist_ok=True) # Ensure the output directory exists + with open(output_file, "wt") as f: + f.write(output_content) + print(f"{output_file} has been generated successfully.") + + +# Run the function to generate the .gni file +if __name__ == "__main__": + generate_gni_file() diff --git a/src/python_testing/test_metadata.yaml b/src/python_testing/test_metadata.yaml new file mode 100644 index 0000000000..3ff104a1a5 --- /dev/null +++ b/src/python_testing/test_metadata.yaml @@ -0,0 +1,102 @@ +# Tests that are NOT executed in CI, along with the reason on +# why they are not. +not_automated: + - name: MinimalRepresentation.py + reason: Code/Test not being used or not shared code for any other tests + - name: TC_CNET_4_4.py + reason: It has no CI execution block, is not executed in CI + - name: TC_DGGEN_3_2.py + reason: + src/python_testing/test_testing/test_TC_DGGEN_3_2.py is the Unit test + of this test + - name: TC_EEVSE_Utils.py + reason: Shared code for TC_EEVSE, not a standalone test + - name: TC_EWATERHTRBase.py + reason: Shared code for TC_EWATERHTR, not a standalone test + - name: TC_EnergyReporting_Utils.py + reason: Shared code for TC_EEM and TC_EPM, not a standalone test + - name: TC_OpstateCommon.py + reason: Shared code for TC_OPSTATE, not a standalone test + - name: TC_pics_checker.py + reason: + Currently isn't enabled because we don't have any examples with + conformant PICS + - name: TC_TMP_2_1.py + reason: + src/python_testing/test_testing/test_TC_TMP_2_1.py is the Unit test of + this test + - name: TC_OCC_3_1.py + reason: + There are CI issues for the test cases that implements manually + controlling sensor device for the occupancy state ON/OFF change + - name: TC_OCC_3_2.py + reason: + There are CI issues for the test cases that implements manually + controlling sensor device for the occupancy state ON/OFF change + - name: TestCommissioningTimeSync.py + reason: Code/Test not being used or not shared code for any other tests + - name: TestConformanceSupport.py + reason: Unit test - does not run against an app + - name: TestChoiceConformanceSupport.py + reason: Unit test - does not run against an app + - name: TC_DEMTestBase.py + reason: Shared code for TC_DEM, not a standalone test + - name: TestConformanceTest.py + reason: + Unit test of the conformance test (TC_DeviceConformance) - does not + run against an app + - name: TestIdChecks.py + reason: Unit test - does not run against an app + - name: TestSpecParsingDeviceType.py + reason: Unit test - does not run against an app + - name: TestConformanceTest.py + reason: Unit test - does not run against an app + - name: TestMatterTestingSupport.py + reason: Unit test - does not run against an app + - name: TestSpecParsingSupport.py + reason: Unit test - does not run against an app + - name: TestTimeSyncTrustedTimeSource.py + reason: + Unit test and shared code for + scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py + - name: drlk_2_x_common.py + reason: Shared code for TC_DRLK, not a standalone test + - name: execute_python_tests.py + reason: + Python code that runs all the python tests from src/python_testing + (This code itself run via tests.yaml) + - name: hello_external_runner.py + reason: Code/Test not being used or not shared code for any other tests + - name: hello_test.py + reason: Is a template for tests + - name: test_plan_support.py + reason: Shared code for TC_*, not a standalone test + - name: test_plan_table_generator.py + reason: Code/Test not being used or not shared code for any other tests + +# This is a list of slow tests (just arbitrarely picked around 20 seconds) +# used in some script reporting for "be patient" messages as well as potentially +# to consider improving. May not be exhaustive +slow_tests: + - { name: mobile-device-test.py, duration: 3 minutes } + - { name: TC_AccessChecker.py, duration: 1.5 minutes } + - { name: TC_BRBINFO_4_1.py, duration: 2 minutes } + - { name: TC_CADMIN_1_9.py, duration: 40 seconds } + - { name: TC_CC_2_2.py, duration: 1.5 minutes } + - { name: TC_DEM_2_10.py, duration: 40 seconds } + - { name: TC_DeviceBasicComposition.py, duration: 25 seconds } + - { name: TC_DRLK_2_12.py, duration: 30 seconds } + - { name: TC_DRLK_2_3.py, duration: 30 seconds } + - { name: TC_EEVSE_2_6.py, duration: 30 seconds } + - { name: TC_FAN_3_1.py, duration: 15 seconds } + - { name: TC_MCORE_FS_1_4.py, duration: 20 seconds } + - { name: TC_OPSTATE_2_5.py, duration: 1.25 minutes } + - { name: TC_OPSTATE_2_6.py, duration: 35 seconds } + - { name: TC_PS_2_3.py, duration: 30 seconds } + - { name: TC_RR_1_1.py, duration: 25 seconds } + - { name: TC_SWTCH.py, duration: 1 minute } + - { name: TC_TIMESYNC_2_10.py, duration: 20 seconds } + - { name: TC_TIMESYNC_2_11.py, duration: 30 seconds } + - { name: TC_TIMESYNC_2_12.py, duration: 20 seconds } + - { name: TC_TIMESYNC_2_7.py, duration: 20 seconds } + - { name: TC_TIMESYNC_2_8.py, duration: 1.5 minutes } diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn index 40ae99ae99..a8d15cf83f 100644 --- a/src/system/BUILD.gn +++ b/src/system/BUILD.gn @@ -177,7 +177,7 @@ source_set("system_config_header") { public_deps += [ "${lwip_root}:lwip" ] } else { if (chip_device_platform == "efr32") { - public_deps += [ "${efr32_sdk_build_root}:efr32_sdk" ] + public_deps += [ "${silabs_sdk_build_root}:silabs_sdk" ] } if (chip_device_platform == "qpg") { public_deps += [ "${qpg_sdk_build_root}:qpg_sdk" ] diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index 79e1bd25a6..f644d1a23e 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -620,7 +620,6 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese // checked to fit in a size_t. const size_t lBlockSize = static_cast(sumOfSizes); lPacket = reinterpret_cast(chip::Platform::MemoryAlloc(lBlockSize)); - SYSTEM_STATS_INCREMENT(chip::System::Stats::kSystemLayer_NumPacketBufs); #else #error "Unimplemented PacketBuffer storage case" @@ -632,6 +631,8 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese return PacketBufferHandle(); } + SYSTEM_STATS_INCREMENT(chip::System::Stats::kSystemLayer_NumPacketBufs); + lPacket->payload = lPacket->ReserveStart() + aReservedSize; lPacket->len = lPacket->tot_len = 0; lPacket->next = nullptr; diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 1fc16ed47f..9df7e4787a 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -102,7 +102,7 @@ source_set("efr32_test_main") { deps += [ "${chip_root}/third_party/openthread:openthread", "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", + "${examples_plat_dir}:matter-shell", ] } diff --git a/src/test_driver/efr32/args.gni b/src/test_driver/efr32/args.gni index 35be5dd63e..0cdcbbf8df 100644 --- a/src/test_driver/efr32/args.gni +++ b/src/test_driver/efr32/args.gni @@ -30,15 +30,15 @@ openthread_external_platform = pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" -pw_assert_BACKEND = "$dir_pw_assert_log" -pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" pw_unit_test_BACKEND = "$dir_pw_unit_test:light" # Override the executable type and the test main's target. pw_unit_test_EXECUTABLE_TARGET_TYPE = "silabs_executable" pw_unit_test_EXECUTABLE_TARGET_TYPE_FILE = - "${efr32_sdk_build_root}/silabs_executable.gni" + "${silabs_sdk_build_root}/silabs_executable.gni" pw_unit_test_MAIN = "//:efr32_test_main" # Additional variables needed by silabs_executable that must be passed in to pw_test. diff --git a/src/test_driver/linux-cirque/IcdWaitForActiveTest.py b/src/test_driver/linux-cirque/IcdDeviceTest.py similarity index 93% rename from src/test_driver/linux-cirque/IcdWaitForActiveTest.py rename to src/test_driver/linux-cirque/IcdDeviceTest.py index bb2c1cb838..b478689742 100755 --- a/src/test_driver/linux-cirque/IcdWaitForActiveTest.py +++ b/src/test_driver/linux-cirque/IcdDeviceTest.py @@ -43,6 +43,8 @@ TEST_DISCOVERY_TYPE = [0, 1, 2] MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" +TEST_EVENT_KEY_HEX = "00112233445566778899aabbccddeeff" + DEVICE_CONFIG = { 'device0': { 'type': 'MobileDevice', @@ -88,8 +90,8 @@ def run_controller_test(self): self.execute_device_cmd( server, ("CHIPCirqueDaemon.py -- run gdb -batch -return-child-result -q -ex \"set pagination off\" " - "-ex run -ex \"thread apply all bt\" --args {} --thread --discriminator {}").format( - os.path.join(CHIP_REPO, "out/debug/lit_icd/lit-icd-app"), TEST_DISCRIMINATOR)) + "-ex run -ex \"thread apply all bt\" --args {} --thread --discriminator {} --enable-key {}").format( + os.path.join(CHIP_REPO, "out/debug/lit_icd/lit-icd-app"), TEST_DISCRIMINATOR, TEST_EVENT_KEY_HEX)) self.reset_thread_devices(server_ids) @@ -103,10 +105,10 @@ def run_controller_test(self): CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_repl-0.0-py3-none-any.whl"))) command = ("gdb -batch -return-child-result -q -ex run -ex \"thread apply all bt\" " - "--args python3 {} -t 300 -a {} --paa-trust-store-path {}").format( + "--args python3 {} -t 300 -a {} --paa-trust-store-path {} --test-event-key {}").format( os.path.join( - CHIP_REPO, "src/controller/python/test/test_scripts/icd_wait_for_device_test.py"), ethernet_ip, - os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS)) + CHIP_REPO, "src/controller/python/test/test_scripts/icd_device_test.py"), ethernet_ip, + os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS), TEST_EVENT_KEY_HEX) ret = self.execute_device_cmd(req_device_id, command) self.assertEqual(ret['return_code'], '0', diff --git a/src/test_driver/linux-cirque/helper/CHIPTestBase.py b/src/test_driver/linux-cirque/helper/CHIPTestBase.py index ea45a62221..a6756b4800 100644 --- a/src/test_driver/linux-cirque/helper/CHIPTestBase.py +++ b/src/test_driver/linux-cirque/helper/CHIPTestBase.py @@ -143,7 +143,7 @@ def reset_thread_devices(self, devices: Union[List[str], str]): for device_id in devices: # Wait for otbr-agent and CHIP server start self.assertTrue(self.wait_for_device_output( - device_id, "Thread Border Router started on AIL", 10)) + device_id, "Thread interface: wpan0", 10)) self.assertTrue(self.wait_for_device_output( device_id, "[SVR] Server Listening...", 15)) # Clear default Thread network commissioning data diff --git a/src/test_driver/tizen/.gn b/src/test_driver/tizen/.gn index 26cd7015b6..c8f8c5181d 100644 --- a/src/test_driver/tizen/.gn +++ b/src/test_driver/tizen/.gn @@ -31,7 +31,6 @@ default_args = { pw_log_BACKEND = "$dir_pw_log_basic" pw_unit_test_BACKEND = "$dir_pw_unit_test:googletest" - pw_unit_test_MAIN = "$dir_pigweed/third_party/googletest:gmock_main" dir_pw_third_party_googletest = "$dir_googletest" # TODO: Make sure only unit tests link against this diff --git a/src/test_driver/tizen/chip_tests/BUILD.gn b/src/test_driver/tizen/chip_tests/BUILD.gn index 47be879235..ba72060b89 100644 --- a/src/test_driver/tizen/chip_tests/BUILD.gn +++ b/src/test_driver/tizen/chip_tests/BUILD.gn @@ -24,12 +24,15 @@ tizen_qemu_run("chip-tests") { virtio_net = true # Share tests directory. - share = "${root_out_dir}/tests" + share = "${root_out_dir}" + + # Runner script file name. + runner = "runner-${target_name}.sh" # Copy runner script to shared directory. copy("${target_name}:runner") { sources = [ "runner.sh" ] - outputs = [ share + "/runner.sh" ] + outputs = [ share + "/" + runner ] } # Build CHIP unit tests. diff --git a/src/test_driver/tizen/chip_tests/runner.sh b/src/test_driver/tizen/chip_tests/runner.sh index 1cc401626c..cad90e20e0 100755 --- a/src/test_driver/tizen/chip_tests/runner.sh +++ b/src/test_driver/tizen/chip_tests/runner.sh @@ -21,6 +21,10 @@ set -e # Print CHIP logs on stdout dlogutil CHIP & +# Set the correct path for .gcda files +export GCOV_PREFIX=/mnt/chip +export GCOV_PREFIX_STRIP=5 + FAILED=() STATUS=0 @@ -43,7 +47,7 @@ while IFS= read -r TEST; do echo -e "DONE: \e[31mFAIL\e[0m" fi -done < <(find /mnt/chip -type f -executable ! -name runner.sh) +done < <(find /mnt/chip/tests -type f -executable ! -name runner.sh) if [ ! "$STATUS" -eq 0 ]; then echo 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 67de6abd80..49eabcc5c4 100644 --- a/src/test_driver/tizen/integration_tests/lighting-app/BUILD.gn +++ b/src/test_driver/tizen/integration_tests/lighting-app/BUILD.gn @@ -26,10 +26,13 @@ tizen_qemu_run("lighting-app") { # Share output directory. share = "${root_out_dir}" + # Runner script file name. + runner = "runner-${target_name}.sh" + # Copy runner script to shared directory. copy("${target_name}:runner") { sources = [ "runner.sh" ] - outputs = [ share + "/runner.sh" ] + outputs = [ share + "/" + runner ] } # Build applications used in the test. diff --git a/src/test_driver/tizen/integration_tests/lighting-app/runner.sh b/src/test_driver/tizen/integration_tests/lighting-app/runner.sh index 52e7562f47..54ae160b11 100755 --- a/src/test_driver/tizen/integration_tests/lighting-app/runner.sh +++ b/src/test_driver/tizen/integration_tests/lighting-app/runner.sh @@ -21,6 +21,10 @@ set -e # Print CHIP logs on stdout dlogutil CHIP & +# Set the correct path for .gcda files +export GCOV_PREFIX=/mnt/chip +export GCOV_PREFIX_STRIP=5 + # Install lighting Matter app pkgcmd -i -t tpk -p /mnt/chip/org.tizen.matter.*/out/org.tizen.matter.*.tpk # Launch lighting Matter app diff --git a/src/tracing/perfetto/perfetto_tracing.cpp b/src/tracing/perfetto/perfetto_tracing.cpp index f9b00cc7ad..d83007826f 100644 --- a/src/tracing/perfetto/perfetto_tracing.cpp +++ b/src/tracing/perfetto/perfetto_tracing.cpp @@ -133,19 +133,19 @@ void PerfettoBackend::LogMetricEvent(const MetricEvent & event) switch (event.ValueType()) { case ValueType::kInt32: - TRACE_EVENT_INSTANT("Matter", event.key(), "value", event.ValueInt32()); + TRACE_EVENT_INSTANT("Matter", perfetto::DynamicString(event.key()), "value", event.ValueInt32()); break; case ValueType::kUInt32: - TRACE_EVENT_INSTANT("Matter", event.key(), "value", event.ValueUInt32()); + TRACE_EVENT_INSTANT("Matter", perfetto::DynamicString(event.key()), "value", event.ValueUInt32()); break; case ValueType::kChipErrorCode: - TRACE_EVENT_INSTANT("Matter", event.key(), "error", event.ValueErrorCode()); + TRACE_EVENT_INSTANT("Matter", perfetto::DynamicString(event.key()), "error", event.ValueErrorCode()); break; case ValueType::kUndefined: - TRACE_EVENT_INSTANT("Matter", event.key()); + TRACE_EVENT_INSTANT("Matter", perfetto::DynamicString(event.key())); break; default: - TRACE_EVENT_INSTANT("Matter", event.key(), "type", "UNKNOWN"); + TRACE_EVENT_INSTANT("Matter", perfetto::DynamicString(event.key()), "type", "UNKNOWN"); break; } } diff --git a/third_party/nxp/nxp_matter_support b/third_party/nxp/nxp_matter_support index 41e38b6593..69f40517ca 160000 --- a/third_party/nxp/nxp_matter_support +++ b/third_party/nxp/nxp_matter_support @@ -1 +1 @@ -Subproject commit 41e38b6593b68741f2c107d3c5296bfea5b3c1c7 +Subproject commit 69f40517ca5f27fdf3026f695c0d0607b604dc0e diff --git a/third_party/openthread/platforms/efr32/BUILD.gn b/third_party/openthread/platforms/efr32/BUILD.gn index e270db2ae8..88f8f44c10 100644 --- a/third_party/openthread/platforms/efr32/BUILD.gn +++ b/third_party/openthread/platforms/efr32/BUILD.gn @@ -18,8 +18,8 @@ import("//build_overrides/openthread.gni") import("//build_overrides/openthread.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") -import("${efr32_sdk_build_root}/silabs_board.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") +import("${silabs_sdk_build_root}/silabs_board.gni") config("openthread_efr32_config") { defines = [ @@ -48,7 +48,7 @@ source_set("openthread_core_config_efr32") { "${sl_ot_efr32_root}/openthread-core-efr32-config.h", ] - public_deps = [ "${efr32_sdk_build_root}:efr32_sdk" ] + public_deps = [ "${silabs_sdk_build_root}:silabs_sdk" ] public_configs = [ ":openthread_efr32_config" ] } diff --git a/third_party/openthread/platforms/nxp/k32w0/BUILD.gn b/third_party/openthread/platforms/nxp/k32w0/BUILD.gn index bf9ed42e89..9725e59acf 100644 --- a/third_party/openthread/platforms/nxp/k32w0/BUILD.gn +++ b/third_party/openthread/platforms/nxp/k32w0/BUILD.gn @@ -86,7 +86,7 @@ source_set("libopenthread-k32w0") { ] } - if (chip_with_ot_cli == 1) { + if (nxp_enable_ot_cli) { sources += [ "${openthread_root}/examples/apps/cli/cli_uart.cpp" ] } diff --git a/third_party/openthread/platforms/nxp/mcxw71_k32w1/BUILD.gn b/third_party/openthread/platforms/nxp/mcxw71_k32w1/BUILD.gn index b7dc6d3598..5d583fdd89 100644 --- a/third_party/openthread/platforms/nxp/mcxw71_k32w1/BUILD.gn +++ b/third_party/openthread/platforms/nxp/mcxw71_k32w1/BUILD.gn @@ -16,9 +16,10 @@ import("//build_overrides/chip.gni") import("//build_overrides/nxp_sdk.gni") import("//build_overrides/openthread.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") +import("${chip_root}/src/crypto/crypto.gni") +import("${chip_root}/src/platform/device.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") +import("${nxp_sdk_build_root}/nxp_sdk.gni") openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" @@ -42,16 +43,16 @@ config("openthread_k32w1_config") { ] } - if (use_smu2_dynamic) { + if (nxp_use_smu2_dynamic) { defines += [ "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1", "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0", ] } - if (chip_key_storage == "littlefs") { + if (nxp_nvm_component == "littlefs") { defines += [ "OT_PLAT_SAVE_NVM_DATA_ON_IDLE=0" ] - } else if (chip_key_storage == "nvs") { + } else if (nxp_nvm_component == "nvs") { defines += [ "CONFIG_SETTINGS_RUNTIME=1" ] } } @@ -63,7 +64,9 @@ source_set("openthread_core_config_k32w1") { ] public_configs = [ ":openthread_k32w1_config" ] - public_deps = [ nxp_sdk_target ] + if (!nxp_external_sdk) { + public_deps = [ nxp_sdk_target ] + } } source_set("libopenthread-k32w1") { @@ -82,31 +85,36 @@ source_set("libopenthread-k32w1") { if (chip_crypto == "platform") { sources += [ "${openthread_nxp_root}/src/common/crypto/ecdsa_sss.cpp" ] - if (use_hw_sha256) { + if (nxp_use_hw_sha256) { sources += [ "${openthread_nxp_root}/src/common/crypto/sha256_sss.cpp" ] } - if (use_hw_aes) { + if (nxp_use_hw_aes) { sources += [ "${openthread_nxp_root}/src/common/crypto/aes_sss.cpp" ] } - if (chip_key_storage == "fwk_nvm") { + if (nxp_nvm_component == "fwk_nvm") { sources += [ "${openthread_nxp_root}/src/common/flash_nvm.c" ] - } else if (chip_key_storage == "littlefs") { + } else if (nxp_nvm_component == "littlefs") { sources += [ "${openthread_nxp_root}/src/common/flash_fsa.c" ] - } else if (chip_key_storage == "nvs") { + } else if (nxp_nvm_component == "nvs") { sources += [ "${openthread_nxp_root}/src/common/flash_nvs.c" ] } } - if (chip_with_ot_cli == 1) { + if (nxp_enable_ot_cli) { sources += [ "${openthread_root}/examples/apps/cli/cli_uart.cpp" ] } public_deps = [ - "${nxp_sdk_build_root}:nxp_mbedtls", "../..:libopenthread-platform", "../..:libopenthread-platform-utils", - nxp_sdk_target, ] + + if (!nxp_external_sdk) { + public_deps += [ + "${nxp_sdk_build_root}:nxp_mbedtls", + nxp_sdk_target, + ] + } } diff --git a/third_party/openthread/platforms/nxp/rt/rt1060/BUILD.gn b/third_party/openthread/platforms/nxp/rt/rt1060/BUILD.gn index ef44f9048e..66640702f6 100644 --- a/third_party/openthread/platforms/nxp/rt/rt1060/BUILD.gn +++ b/third_party/openthread/platforms/nxp/rt/rt1060/BUILD.gn @@ -57,7 +57,7 @@ config("openthread_rt1060_config") { "OT_APP_BR_LWIP_HOOKS_EN=1", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE=1", "OT_APP_CLI_EPHEMERAL_KEY_ADDON=1", @@ -103,7 +103,7 @@ source_set("libopenthread-rt1060") { "${openthread_nxp_root}/src/common/br/utils.c", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { sources += [ "${openthread_nxp_root}/examples/utils/cli_addons/addons_cli.c", "${openthread_nxp_root}/examples/utils/cli_addons/ephemeral_key/ephemeral_key_cli.c", diff --git a/third_party/openthread/platforms/nxp/rt/rt1170/BUILD.gn b/third_party/openthread/platforms/nxp/rt/rt1170/BUILD.gn index 039c911e51..228f9e0814 100644 --- a/third_party/openthread/platforms/nxp/rt/rt1170/BUILD.gn +++ b/third_party/openthread/platforms/nxp/rt/rt1170/BUILD.gn @@ -56,7 +56,7 @@ config("openthread_rt1170_config") { "OT_APP_BR_LWIP_HOOKS_EN=1", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE=1", "OT_APP_CLI_EPHEMERAL_KEY_ADDON=1", @@ -101,7 +101,7 @@ source_set("libopenthread-rt1170") { "${openthread_nxp_root}/src/common/br/utils.c", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { sources += [ "${openthread_nxp_root}/examples/utils/cli_addons/addons_cli.c", "${openthread_nxp_root}/examples/utils/cli_addons/ephemeral_key/ephemeral_key_cli.c", diff --git a/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn b/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn index 6c00f94b3a..1dbfe5e5a5 100644 --- a/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn +++ b/third_party/openthread/platforms/nxp/rt/rw61x/BUILD.gn @@ -59,7 +59,7 @@ config("openthread_rw61x_config") { "OT_APP_BR_LWIP_HOOKS_EN=1", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE=1", "OT_APP_CLI_EPHEMERAL_KEY_ADDON=1", @@ -99,7 +99,7 @@ source_set("libopenthread-rw61x") { "${openthread_nxp_root}/src/common/br/utils.c", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { sources += [ "${openthread_nxp_root}/examples/utils/cli_addons/addons_cli.c", "${openthread_nxp_root}/examples/utils/cli_addons/ephemeral_key/ephemeral_key_cli.c", diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn index 16e0ba68c4..16d823dd4e 100644 --- a/third_party/silabs/BUILD.gn +++ b/third_party/silabs/BUILD.gn @@ -18,12 +18,12 @@ import("//build_overrides/jlink.gni") import("//build_overrides/openthread.gni") import("${chip_root}/src/lwip/lwip.gni") import("${chip_root}/src/platform/device.gni") -import("${efr32_sdk_build_root}/silabs_board.gni") +import("${silabs_sdk_build_root}/silabs_board.gni") if (wifi_soc == true) { # CCP board - import("${efr32_sdk_build_root}/SiWx917_sdk.gni") + import("${silabs_sdk_build_root}/SiWx917_sdk.gni") } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") } declare_args() { @@ -49,7 +49,7 @@ config("silabs_config") { } assert(silabs_sdk_target != "", "silabs_sdk_target must be specified") -group("efr32_sdk") { +group("silabs_sdk") { public_deps = [ silabs_sdk_target ] public_configs = [ ":silabs_config" ] } @@ -117,7 +117,7 @@ if (wifi_soc != true) { # CCP board public_deps = [ ":libopenthread-platform", - "${efr32_sdk_build_root}:efr32_sdk", + "${silabs_sdk_build_root}:silabs_sdk", ] public_configs = [ ":openthread_efr32_config" ] @@ -190,7 +190,7 @@ if (wifi_soc != true) { # CCP board "${segger_rtt_root}:segger_rtt", ] - deps = [ "${efr32_sdk_build_root}:efr32_sdk" ] + deps = [ "${silabs_sdk_build_root}:silabs_sdk" ] # selected thread device type FTD or MTD XTD = "ftd" diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 3accbed0bc..0bc8c7c693 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -16,12 +16,11 @@ import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") import("//build_overrides/jlink.gni") import("//build_overrides/mbedtls.gni") - import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/lib.gni") -import("${chip_root}/src/platform/silabs/wifi_args.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") import("silabs_board.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" @@ -322,9 +321,12 @@ template("siwx917_sdk") { "SL_ACTIVE_MODE_DURATION_MS=${sl_active_mode_duration_ms}", "SL_IDLE_MODE_DURATION_S=${sl_idle_mode_duration_s}", "SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${sl_icd_supported_clients_per_fabric}", - "SL_SI91X_NPSS_GPIO_BTN_HANDLER=1", "SL_SI91X_POWER_MANAGER_UC_AVAILABLE=1", "SL_SI91X_TICKLESS_MODE=1", + + # Enable Wakeup source for ICD + "SL_ENABLE_GPIO_WAKEUP_SOURCE=1", + "ENABLE_NPSS_GPIO_2=1", ] } @@ -682,7 +684,6 @@ template("siwx917_sdk") { "${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_callback_framework.c", "${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_driver.c", "${wifi_sdk_root}/components/device/silabs/si91x/wireless/threading/sli_si91x_multithreaded.c", - "${wifi_sdk_root}/components/service/network_manager/si91x/sl_net_si91x.c", # modified hal "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_default_common_linker.c", @@ -829,7 +830,7 @@ template("siwx917_sdk") { "${_mbedtls_root}/library/ssl_srv.c", "${_mbedtls_root}/library/ssl_tls.c", "${_mbedtls_root}/library/x509.c", - "${efr32_sdk_build_root}/mqtt/stack/mqtt.c", + "${silabs_sdk_build_root}/mqtt/stack/mqtt.c", ] } diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 146077372f..9ca85baa47 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -96,6 +96,7 @@ declare_args() { examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" silabs_plat_efr32_wifi_dir = "${chip_root}/src/platform/silabs/efr32/wifi" silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" +silabs_platform_dir = "${chip_root}/src/platform/silabs" is_series_2 = silabs_family == "mgm24" || silabs_family == "efr32mg24" || silabs_family == "efr32mg26" @@ -333,6 +334,7 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/firmware", "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/pds/brd8022a", "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/secure_link", + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/config", ] } @@ -365,12 +367,23 @@ template("efr32_sdk") { "${wifi_sdk_root}/components/protocol/wifi/si91x", ] } + + if (use_rs9116) { + # TODO: we should create a seperate directory for headers that are necessary for the underlying sdks + _include_dirs += [ + "${chip_root}/src/platform/silabs/wifi/rs911x/platform", + "${chip_root}/src/platform/silabs/wifi/rs911x", + ] + } + if (use_rs9116 || use_SiWx917) { _include_dirs += [ "${chip_root}/src/platform/silabs/rs911x" ] } + if (use_wf200 || use_rs9116 || use_SiWx917) { _include_dirs += [ "${chip_root}/src/platform/silabs/wifi" ] } + if (silabs_family != "mgm24") { _include_dirs += [ "${efr32_sdk_root}/platform/radio/rail_lib/hal", @@ -583,7 +596,7 @@ template("efr32_sdk") { } if (use_wf200 || use_rs9116 || use_SiWx917) { - import("${chip_root}/src/platform/silabs/wifi_args.gni") + import("${chip_root}/src/platform/silabs/wifi/args.gni") defines += [ "LWIP_NETIF_API=1" ] if (chip_enable_wifi_ipv4) { diff --git a/third_party/silabs/lwip.gni b/third_party/silabs/lwip.gni index 9a35e7c45f..db19c08839 100644 --- a/third_party/silabs/lwip.gni +++ b/third_party/silabs/lwip.gni @@ -13,7 +13,7 @@ # limitations under the License. import("//build_overrides/efr32_sdk.gni") import("//build_overrides/lwip.gni") -import("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${silabs_sdk_build_root}/efr32_sdk.gni") # Defines a lwIP build target. # diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index bf647de36d..eab695e438 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit bf647de36d841e62fdac5d37c0cdfc5ebf9200bc +Subproject commit eab695e438ada903a18956eb916696678227cb0d diff --git a/third_party/silabs/silabs_lwip/BUILD.gn b/third_party/silabs/silabs_lwip/BUILD.gn index e148763a9c..4d0bcb24c5 100644 --- a/third_party/silabs/silabs_lwip/BUILD.gn +++ b/third_party/silabs/silabs_lwip/BUILD.gn @@ -41,7 +41,7 @@ lwip_target("silabs_lwip") { public_deps = [ "${chip_root}/src/lwip:lwip_buildconfig", - "${efr32_sdk_build_root}:efr32_sdk", + "${silabs_sdk_build_root}:silabs_sdk", ] public_configs = [ diff --git a/third_party/tizen/tizen_qemu.py b/third_party/tizen/tizen_qemu.py index 93bdfd3666..7b7eb412a2 100755 --- a/third_party/tizen/tizen_qemu.py +++ b/third_party/tizen/tizen_qemu.py @@ -66,9 +66,10 @@ "default: $TIZEN_SDK_ROOT/iot-sysdata.img")) parser.add_argument( '--share', type=str, - help=("host directory to share with the guest; if file named 'runner.sh' " - "is present at the root of that directory, it will be executed " - "automatically after boot")) + help=("host directory to share with the guest")) +parser.add_argument( + '--runner', type=str, + help=("path to the runner script which will run automatically after boot. path should be relative to shared directory")) parser.add_argument( '--output', metavar='FILE', default="/dev/null", help="store the QEMU output in a FILE") @@ -136,6 +137,9 @@ def whereis(binary_name): # Run root shell instead of the runner script. kernel_args += " rootshell" +if args.runner: + kernel_args += " runner=/mnt/chip/%s" % args.runner + qemu_args += [ '-kernel', args.kernel, '-append', kernel_args, @@ -153,7 +157,7 @@ def whereis(binary_name): for line in iter(proc.stdout.readline, b''): # Forward the output to the stdout and the log file. - sys.stdout.write(line.decode(sys.stdout.encoding)) + sys.stdout.write(line.decode(sys.stdout.encoding, errors='ignore')) sys.stdout.flush() output.write(line) diff --git a/third_party/tizen/tizen_sdk.gni b/third_party/tizen/tizen_sdk.gni index 72fb207773..fbf82756a2 100644 --- a/third_party/tizen/tizen_sdk.gni +++ b/third_party/tizen/tizen_sdk.gni @@ -175,6 +175,7 @@ template("tizen_qemu_run") { testonly = true assert(defined(invoker.share), "It is required to specify path to share.") + assert(defined(invoker.runner), "It is required to specify runner script.") # Store QEMU output in a dedicated log file. output_log_file = "${root_out_dir}/tizen-qemu-" + target_name + ".log" @@ -186,6 +187,7 @@ template("tizen_qemu_run") { args = [ "--share=" + invoker.share, + "--runner=" + invoker.runner, "--output=" + rebase_path(output_log_file), ] if (defined(invoker.virtio_net) && invoker.virtio_net) { 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 c23e0e252b..afb3da76dc 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 @@ -37487,147 +37487,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters } // namespace NightVisionIllum -namespace AWBEnabled { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::CameraAvStreamManagement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); -} - -} // namespace AWBEnabled - -namespace AutoShutterSpeedEnabled { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::CameraAvStreamManagement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); -} - -} // namespace AutoShutterSpeedEnabled - -namespace AutoISOEnabled { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::CameraAvStreamManagement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); -} - -} // namespace AutoISOEnabled - namespace SpeakerMuted { Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value) @@ -38381,55 +38240,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters } // namespace StatusLightBrightness -namespace DepthSensorStatus { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, - chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum value, - MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::CameraAvStreamManagement::Id, Id), - EmberAfWriteDataInput(writable, ZCL_ENUM8_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::CameraAvStreamManagement::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -} // namespace DepthSensorStatus - namespace FeatureMap { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) @@ -38730,98 +38540,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) namespace Chime { namespace Attributes { -namespace ActiveChimeID { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = emberAfReadAttribute(endpoint, Clusters::Chime::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::Chime::Id, Id), - EmberAfWriteDataInput(writable, ZCL_INT8U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Chime::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace ActiveChimeID - -namespace Enabled { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = emberAfReadAttribute(endpoint, Clusters::Chime::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::Chime::Id, Id), - EmberAfWriteDataInput(writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Chime::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); -} - -} // namespace Enabled - namespace FeatureMap { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value) 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 11e2228564..c79c0657c5 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 @@ -5683,24 +5683,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters MarkAttributeDirty markDirty); } // namespace NightVisionIllum -namespace AWBEnabled { -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value); // boolean -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty); -} // namespace AWBEnabled - -namespace AutoShutterSpeedEnabled { -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value); // boolean -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty); -} // namespace AutoShutterSpeedEnabled - -namespace AutoISOEnabled { -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value); // boolean -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty); -} // namespace AutoISOEnabled - namespace SpeakerMuted { Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value); // boolean Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value); @@ -5799,14 +5781,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters MarkAttributeDirty markDirty); } // namespace StatusLightBrightness -namespace DepthSensorStatus { -Protocols::InteractionModel::Status -Get(EndpointId endpoint, chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum * value); // TriStateAutoEnum -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum value, - MarkAttributeDirty markDirty); -} // namespace DepthSensorStatus - namespace FeatureMap { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // bitmap32 Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); @@ -5861,18 +5835,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, Mar namespace Chime { namespace Attributes { -namespace ActiveChimeID { -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint8_t * value); // int8u -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); -} // namespace ActiveChimeID - -namespace Enabled { -Protocols::InteractionModel::Status Get(EndpointId endpoint, bool * value); // boolean -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, bool value, MarkAttributeDirty markDirty); -} // namespace Enabled - namespace FeatureMap { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint32_t * value); // bitmap32 Protocols::InteractionModel::Status Set(EndpointId endpoint, uint32_t value); 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 90be263281..1c8cccc476 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -6852,30 +6852,6 @@ bool emberAfCameraAvStreamManagementClusterSetStreamPrioritiesCallback( bool emberAfCameraAvStreamManagementClusterCaptureSnapshotCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::CameraAvStreamManagement::Commands::CaptureSnapshot::DecodableType & commandData); -/** - * @brief Camera AV Stream Management Cluster SetViewport Command callback (from client) - */ -bool emberAfCameraAvStreamManagementClusterSetViewportCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::DecodableType & commandData); -/** - * @brief Camera AV Stream Management Cluster SetImageRotation Command callback (from client) - */ -bool emberAfCameraAvStreamManagementClusterSetImageRotationCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::DecodableType & commandData); -/** - * @brief Camera AV Stream Management Cluster SetImageFlipHorizontal Command callback (from client) - */ -bool emberAfCameraAvStreamManagementClusterSetImageFlipHorizontalCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::DecodableType & commandData); -/** - * @brief Camera AV Stream Management Cluster SetImageFlipVertical Command callback (from client) - */ -bool emberAfCameraAvStreamManagementClusterSetImageFlipVerticalCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::DecodableType & commandData); /** * @brief WebRTC Transport Provider Cluster SolicitOffer Command callback (from client) */ @@ -6930,12 +6906,6 @@ bool emberAfWebRTCTransportRequestorClusterICECandidateCallback( bool emberAfWebRTCTransportRequestorClusterEndCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::WebRTCTransportRequestor::Commands::End::DecodableType & commandData); -/** - * @brief Chime Cluster PlayChimeSound Command callback (from client) - */ -bool emberAfChimeClusterPlayChimeSoundCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Chime::Commands::PlayChimeSound::DecodableType & commandData); /** * @brief Commissioner Control Cluster RequestCommissioningApproval Command callback (from client) */ 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 586eeb91af..aae67302e4 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 @@ -5526,6 +5526,7 @@ enum class ZoneUseEnum : uint8_t enum class Feature : uint32_t { kTwoDimensionalCartesianZone = 0x1, + kPerZoneSensitivity = 0x2, }; } // namespace ZoneManagement @@ -5599,12 +5600,12 @@ enum class VideoCodecEnum : uint8_t // Bitmap for Feature enum class Feature : uint32_t { - kPrivacy = 0x1, - kAudio = 0x2, - kSpeaker = 0x4, - kImageControl = 0x8, - kVideo = 0x10, - kSnapshot = 0x20, + kAudio = 0x1, + kVideo = 0x2, + kSnapshot = 0x4, + kPrivacy = 0x8, + kSpeaker = 0x10, + kImageControl = 0x20, kWatermark = 0x40, kOnScreenDisplay = 0x80, kLocalStorage = 0x100, 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 111324e9cb..f2c2ea2ef5 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 @@ -28541,7 +28541,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace ZoneInformationStruct -namespace ZoneTriggeringTimeControlStruct { +namespace ZoneTriggerControlStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; @@ -28549,6 +28549,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const encoder.Encode(to_underlying(Fields::kAugmentationDuration), augmentationDuration); encoder.Encode(to_underlying(Fields::kMaxDuration), maxDuration); encoder.Encode(to_underlying(Fields::kBlindDuration), blindDuration); + encoder.Encode(to_underlying(Fields::kSensitivity), sensitivity); return encoder.Finalize(); } @@ -28582,6 +28583,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, blindDuration); } + else if (__context_tag == to_underlying(Fields::kSensitivity)) + { + err = DataModel::Decode(reader, sensitivity); + } else { } @@ -28590,7 +28595,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace ZoneTriggeringTimeControlStruct +} // namespace ZoneTriggerControlStruct } // namespace Structs namespace Commands { @@ -28814,8 +28819,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, supportedZoneSources); case Attributes::Zones::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, zones); - case Attributes::TimeControl::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, timeControl); + case Attributes::Triggers::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, triggers); case Attributes::Sensitivity::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, sensitivity); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): @@ -29983,142 +29988,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace CaptureSnapshotResponse. -namespace SetViewport { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kViewport), viewport); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kViewport)) - { - err = DataModel::Decode(reader, viewport); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetViewport. -namespace SetImageRotation { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kAngle), angle); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kAngle)) - { - err = DataModel::Decode(reader, angle); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetImageRotation. -namespace SetImageFlipHorizontal { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kEnabled), enabled); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kEnabled)) - { - err = DataModel::Decode(reader, enabled); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetImageFlipHorizontal. -namespace SetImageFlipVertical { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kEnabled), enabled); - return encoder.Finalize(); -} - -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) -{ - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kEnabled)) - { - err = DataModel::Decode(reader, enabled); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetImageFlipVertical. } // namespace Commands namespace Attributes { @@ -30178,12 +30047,6 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, nightVision); case Attributes::NightVisionIllum::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, nightVisionIllum); - case Attributes::AWBEnabled::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, AWBEnabled); - case Attributes::AutoShutterSpeedEnabled::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, autoShutterSpeedEnabled); - case Attributes::AutoISOEnabled::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, autoISOEnabled); case Attributes::Viewport::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, viewport); case Attributes::SpeakerMuted::TypeInfo::GetAttributeId(): @@ -30218,8 +30081,6 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, statusLightEnabled); case Attributes::StatusLightBrightness::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, statusLightBrightness); - case Attributes::DepthSensorStatus::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, depthSensorStatus); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -35101,5 +34962,20 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } +bool CommandHasLargePayload(ClusterId aCluster, CommandId aCommand) +{ + if ((aCluster == Clusters::CameraAvStreamManagement::Id) && + (aCommand == Clusters::CameraAvStreamManagement::Commands::CaptureSnapshot::Id)) + { + return true; + } + if ((aCluster == Clusters::CameraAvStreamManagement::Id) && + (aCommand == Clusters::CameraAvStreamManagement::Commands::CaptureSnapshotResponse::Id)) + { + return true; + } + return false; +} + } // namespace app } // namespace chip 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 d7f69cc381..35e2682528 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 @@ -40482,13 +40482,14 @@ struct Type using DecodableType = Type; } // namespace ZoneInformationStruct -namespace ZoneTriggeringTimeControlStruct { +namespace ZoneTriggerControlStruct { enum class Fields : uint8_t { kInitialDuration = 0, kAugmentationDuration = 1, kMaxDuration = 2, kBlindDuration = 3, + kSensitivity = 4, }; struct Type @@ -40498,6 +40499,7 @@ struct Type uint16_t augmentationDuration = static_cast(0); uint32_t maxDuration = static_cast(0); uint16_t blindDuration = static_cast(0); + Optional sensitivity; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -40508,7 +40510,7 @@ struct Type using DecodableType = Type; -} // namespace ZoneTriggeringTimeControlStruct +} // namespace ZoneTriggerControlStruct } // namespace Structs namespace Commands { @@ -40772,21 +40774,20 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace Zones -namespace TimeControl { +namespace Triggers { struct TypeInfo { - using Type = - chip::app::DataModel::List; - using DecodableType = chip::app::DataModel::DecodableList< - chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::DecodableType>; + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; using DecodableArgType = const chip::app::DataModel::DecodableList< - chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::DecodableType> &; + chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::DecodableType> &; static constexpr ClusterId GetClusterId() { return Clusters::ZoneManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::TimeControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Triggers::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace TimeControl +} // namespace Triggers namespace Sensitivity { struct TypeInfo { @@ -40840,7 +40841,7 @@ struct TypeInfo Attributes::SupportedZoneSources::TypeInfo::DecodableType supportedZoneSources; Attributes::Zones::TypeInfo::DecodableType zones; - Attributes::TimeControl::TypeInfo::DecodableType timeControl; + Attributes::Triggers::TypeInfo::DecodableType triggers; Attributes::Sensitivity::TypeInfo::DecodableType sensitivity = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; @@ -41253,26 +41254,6 @@ struct Type; struct DecodableType; } // namespace CaptureSnapshotResponse -namespace SetViewport { -struct Type; -struct DecodableType; -} // namespace SetViewport - -namespace SetImageRotation { -struct Type; -struct DecodableType; -} // namespace SetImageRotation - -namespace SetImageFlipHorizontal { -struct Type; -struct DecodableType; -} // namespace SetImageFlipHorizontal - -namespace SetImageFlipVertical { -struct Type; -struct DecodableType; -} // namespace SetImageFlipVertical - } // namespace Commands namespace Commands { @@ -41773,134 +41754,6 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace CaptureSnapshotResponse -namespace SetViewport { -enum class Fields : uint8_t -{ - kViewport = 0, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetViewport::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - Structs::ViewportStruct::Type viewport; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::SetViewport::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - Structs::ViewportStruct::DecodableType viewport; - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetViewport -namespace SetImageRotation { -enum class Fields : uint8_t -{ - kAngle = 0, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetImageRotation::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - uint16_t angle = static_cast(0); - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::SetImageRotation::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - uint16_t angle = static_cast(0); - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetImageRotation -namespace SetImageFlipHorizontal { -enum class Fields : uint8_t -{ - kEnabled = 0, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetImageFlipHorizontal::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - bool enabled = static_cast(0); - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::SetImageFlipHorizontal::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - bool enabled = static_cast(0); - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetImageFlipHorizontal -namespace SetImageFlipVertical { -enum class Fields : uint8_t -{ - kEnabled = 0, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetImageFlipVertical::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - bool enabled = static_cast(0); - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::SetImageFlipVertical::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - - bool enabled = static_cast(0); - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetImageFlipVertical } // namespace Commands namespace Attributes { @@ -42232,42 +42085,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace NightVisionIllum -namespace AWBEnabled { -struct TypeInfo -{ - using Type = bool; - using DecodableType = bool; - using DecodableArgType = bool; - - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::AWBEnabled::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace AWBEnabled -namespace AutoShutterSpeedEnabled { -struct TypeInfo -{ - using Type = bool; - using DecodableType = bool; - using DecodableArgType = bool; - - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::AutoShutterSpeedEnabled::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace AutoShutterSpeedEnabled -namespace AutoISOEnabled { -struct TypeInfo -{ - using Type = bool; - using DecodableType = bool; - using DecodableArgType = bool; - - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::AutoISOEnabled::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace AutoISOEnabled namespace Viewport { struct TypeInfo { @@ -42472,18 +42289,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace StatusLightBrightness -namespace DepthSensorStatus { -struct TypeInfo -{ - using Type = chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum; - using DecodableType = chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum; - using DecodableArgType = chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum; - - static constexpr ClusterId GetClusterId() { return Clusters::CameraAvStreamManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::DepthSensorStatus::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace DepthSensorStatus namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -42553,9 +42358,6 @@ struct TypeInfo static_cast(0); Attributes::NightVisionIllum::TypeInfo::DecodableType nightVisionIllum = static_cast(0); - Attributes::AWBEnabled::TypeInfo::DecodableType AWBEnabled = static_cast(0); - Attributes::AutoShutterSpeedEnabled::TypeInfo::DecodableType autoShutterSpeedEnabled = static_cast(0); - Attributes::AutoISOEnabled::TypeInfo::DecodableType autoISOEnabled = static_cast(0); Attributes::Viewport::TypeInfo::DecodableType viewport; Attributes::SpeakerMuted::TypeInfo::DecodableType speakerMuted = static_cast(0); Attributes::SpeakerVolumeLevel::TypeInfo::DecodableType speakerVolumeLevel = static_cast(0); @@ -42574,8 +42376,6 @@ struct TypeInfo Attributes::StatusLightEnabled::TypeInfo::DecodableType statusLightEnabled = static_cast(0); Attributes::StatusLightBrightness::TypeInfo::DecodableType statusLightBrightness = static_cast(0); - Attributes::DepthSensorStatus::TypeInfo::DecodableType depthSensorStatus = - static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::AttributeList::TypeInfo::DecodableType attributeList; @@ -47768,6 +47568,7 @@ struct DecodableType bool CommandNeedsTimedInvoke(ClusterId aCluster, CommandId aCommand); bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand); +bool CommandHasLargePayload(ClusterId aCluster, CommandId aCommand); } // namespace app } // namespace chip 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 e9375f5dad..e0fa3a25fd 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 @@ -6832,9 +6832,9 @@ namespace Zones { static constexpr AttributeId Id = 0x00000001; } // namespace Zones -namespace TimeControl { +namespace Triggers { static constexpr AttributeId Id = 0x00000002; -} // namespace TimeControl +} // namespace Triggers namespace Sensitivity { static constexpr AttributeId Id = 0x00000003; @@ -6970,90 +6970,74 @@ namespace NightVisionIllum { static constexpr AttributeId Id = 0x00000019; } // namespace NightVisionIllum -namespace AWBEnabled { -static constexpr AttributeId Id = 0x0000001A; -} // namespace AWBEnabled - -namespace AutoShutterSpeedEnabled { -static constexpr AttributeId Id = 0x0000001B; -} // namespace AutoShutterSpeedEnabled - -namespace AutoISOEnabled { -static constexpr AttributeId Id = 0x0000001C; -} // namespace AutoISOEnabled - namespace Viewport { -static constexpr AttributeId Id = 0x0000001D; +static constexpr AttributeId Id = 0x0000001A; } // namespace Viewport namespace SpeakerMuted { -static constexpr AttributeId Id = 0x0000001E; +static constexpr AttributeId Id = 0x0000001B; } // namespace SpeakerMuted namespace SpeakerVolumeLevel { -static constexpr AttributeId Id = 0x0000001F; +static constexpr AttributeId Id = 0x0000001C; } // namespace SpeakerVolumeLevel namespace SpeakerMaxLevel { -static constexpr AttributeId Id = 0x00000020; +static constexpr AttributeId Id = 0x0000001D; } // namespace SpeakerMaxLevel namespace SpeakerMinLevel { -static constexpr AttributeId Id = 0x00000021; +static constexpr AttributeId Id = 0x0000001E; } // namespace SpeakerMinLevel namespace MicrophoneMuted { -static constexpr AttributeId Id = 0x00000022; +static constexpr AttributeId Id = 0x0000001F; } // namespace MicrophoneMuted namespace MicrophoneVolumeLevel { -static constexpr AttributeId Id = 0x00000023; +static constexpr AttributeId Id = 0x00000020; } // namespace MicrophoneVolumeLevel namespace MicrophoneMaxLevel { -static constexpr AttributeId Id = 0x00000024; +static constexpr AttributeId Id = 0x00000021; } // namespace MicrophoneMaxLevel namespace MicrophoneMinLevel { -static constexpr AttributeId Id = 0x00000025; +static constexpr AttributeId Id = 0x00000022; } // namespace MicrophoneMinLevel namespace MicrophoneAGCEnabled { -static constexpr AttributeId Id = 0x00000026; +static constexpr AttributeId Id = 0x00000023; } // namespace MicrophoneAGCEnabled namespace ImageRotation { -static constexpr AttributeId Id = 0x00000027; +static constexpr AttributeId Id = 0x00000024; } // namespace ImageRotation namespace ImageFlipHorizontal { -static constexpr AttributeId Id = 0x00000028; +static constexpr AttributeId Id = 0x00000025; } // namespace ImageFlipHorizontal namespace ImageFlipVertical { -static constexpr AttributeId Id = 0x00000029; +static constexpr AttributeId Id = 0x00000026; } // namespace ImageFlipVertical namespace LocalVideoRecordingEnabled { -static constexpr AttributeId Id = 0x0000002A; +static constexpr AttributeId Id = 0x00000027; } // namespace LocalVideoRecordingEnabled namespace LocalSnapshotRecordingEnabled { -static constexpr AttributeId Id = 0x0000002B; +static constexpr AttributeId Id = 0x00000028; } // namespace LocalSnapshotRecordingEnabled namespace StatusLightEnabled { -static constexpr AttributeId Id = 0x0000002C; +static constexpr AttributeId Id = 0x00000029; } // namespace StatusLightEnabled namespace StatusLightBrightness { -static constexpr AttributeId Id = 0x0000002D; +static constexpr AttributeId Id = 0x0000002A; } // namespace StatusLightBrightness -namespace DepthSensorStatus { -static constexpr AttributeId Id = 0x0000002E; -} // namespace DepthSensorStatus - namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList 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 5a07d8ac1b..d46b8ae076 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 @@ -1888,22 +1888,6 @@ namespace CaptureSnapshotResponse { static constexpr CommandId Id = 0x0000000C; } // namespace CaptureSnapshotResponse -namespace SetViewport { -static constexpr CommandId Id = 0x0000000D; -} // namespace SetViewport - -namespace SetImageRotation { -static constexpr CommandId Id = 0x0000000E; -} // namespace SetImageRotation - -namespace SetImageFlipHorizontal { -static constexpr CommandId Id = 0x0000000F; -} // namespace SetImageFlipHorizontal - -namespace SetImageFlipVertical { -static constexpr CommandId Id = 0x00000010; -} // namespace SetImageFlipVertical - } // namespace Commands } // namespace CameraAvStreamManagement diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 4ee3c3e1f9..3fca885315 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -13540,7 +13540,7 @@ class ContentAppObserverContentAppMessage : public ClusterCommand | Attributes: | | | * SupportedZoneSources | 0x0000 | | * Zones | 0x0001 | -| * TimeControl | 0x0002 | +| * Triggers | 0x0002 | | * Sensitivity | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | @@ -13720,10 +13720,6 @@ class ZoneManagementRemoveZone : public ClusterCommand | * SnapshotStreamDeallocate | 0x09 | | * SetStreamPriorities | 0x0A | | * CaptureSnapshot | 0x0B | -| * SetViewport | 0x0D | -| * SetImageRotation | 0x0E | -| * SetImageFlipHorizontal | 0x0F | -| * SetImageFlipVertical | 0x10 | |------------------------------------------------------------------------------| | Attributes: | | | * MaxConcurrentVideoEncoders | 0x0000 | @@ -13752,27 +13748,23 @@ class ZoneManagementRemoveZone : public ClusterCommand | * HardPrivacyModeOn | 0x0017 | | * NightVision | 0x0018 | | * NightVisionIllum | 0x0019 | -| * AWBEnabled | 0x001A | -| * AutoShutterSpeedEnabled | 0x001B | -| * AutoISOEnabled | 0x001C | -| * Viewport | 0x001D | -| * SpeakerMuted | 0x001E | -| * SpeakerVolumeLevel | 0x001F | -| * SpeakerMaxLevel | 0x0020 | -| * SpeakerMinLevel | 0x0021 | -| * MicrophoneMuted | 0x0022 | -| * MicrophoneVolumeLevel | 0x0023 | -| * MicrophoneMaxLevel | 0x0024 | -| * MicrophoneMinLevel | 0x0025 | -| * MicrophoneAGCEnabled | 0x0026 | -| * ImageRotation | 0x0027 | -| * ImageFlipHorizontal | 0x0028 | -| * ImageFlipVertical | 0x0029 | -| * LocalVideoRecordingEnabled | 0x002A | -| * LocalSnapshotRecordingEnabled | 0x002B | -| * StatusLightEnabled | 0x002C | -| * StatusLightBrightness | 0x002D | -| * DepthSensorStatus | 0x002E | +| * Viewport | 0x001A | +| * SpeakerMuted | 0x001B | +| * SpeakerVolumeLevel | 0x001C | +| * SpeakerMaxLevel | 0x001D | +| * SpeakerMinLevel | 0x001E | +| * MicrophoneMuted | 0x001F | +| * MicrophoneVolumeLevel | 0x0020 | +| * MicrophoneMaxLevel | 0x0021 | +| * MicrophoneMinLevel | 0x0022 | +| * MicrophoneAGCEnabled | 0x0023 | +| * ImageRotation | 0x0024 | +| * ImageFlipHorizontal | 0x0025 | +| * ImageFlipVertical | 0x0026 | +| * LocalVideoRecordingEnabled | 0x0027 | +| * LocalSnapshotRecordingEnabled | 0x0028 | +| * StatusLightEnabled | 0x0029 | +| * StatusLightBrightness | 0x002A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -14168,159 +14160,6 @@ class CameraAvStreamManagementCaptureSnapshot : public ClusterCommand mComplex_RequestedResolution; }; -/* - * Command SetViewport - */ -class CameraAvStreamManagementSetViewport : public ClusterCommand -{ -public: - CameraAvStreamManagementSetViewport(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-viewport", credsIssuerConfig), mComplex_Viewport(&mRequest.viewport) - { - AddArgument("Viewport", &mComplex_Viewport); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Type mRequest; - TypedComplexArgument mComplex_Viewport; -}; - -/* - * Command SetImageRotation - */ -class CameraAvStreamManagementSetImageRotation : public ClusterCommand -{ -public: - CameraAvStreamManagementSetImageRotation(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-image-rotation", credsIssuerConfig) - { - AddArgument("Angle", 0, UINT16_MAX, &mRequest.angle); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Type mRequest; -}; - -/* - * Command SetImageFlipHorizontal - */ -class CameraAvStreamManagementSetImageFlipHorizontal : public ClusterCommand -{ -public: - CameraAvStreamManagementSetImageFlipHorizontal(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-image-flip-horizontal", credsIssuerConfig) - { - AddArgument("Enabled", 0, 1, &mRequest.enabled); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Type mRequest; -}; - -/* - * Command SetImageFlipVertical - */ -class CameraAvStreamManagementSetImageFlipVertical : public ClusterCommand -{ -public: - CameraAvStreamManagementSetImageFlipVertical(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-image-flip-vertical", credsIssuerConfig) - { - AddArgument("Enabled", 0, 1, &mRequest.enabled); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Type mRequest; -}; - /*----------------------------------------------------------------------------*\ | Cluster WebRTCTransportProvider | 0x0553 | |------------------------------------------------------------------------------| @@ -26836,7 +26675,7 @@ void registerClusterZoneManagement(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // make_unique(Id, "supported-zone-sources", Attributes::SupportedZoneSources::Id, credsIssuerConfig), // make_unique(Id, "zones", Attributes::Zones::Id, credsIssuerConfig), // - make_unique(Id, "time-control", Attributes::TimeControl::Id, credsIssuerConfig), // + make_unique(Id, "triggers", Attributes::Triggers::Id, credsIssuerConfig), // make_unique(Id, "sensitivity", Attributes::Sensitivity::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // @@ -26851,8 +26690,8 @@ void registerClusterZoneManagement(Commands & commands, CredentialIssuerCommands chip::app::DataModel::List>>( Id, "zones", Attributes::Zones::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( - Id, "time-control", Attributes::TimeControl::Id, WriteCommandType::kWrite, credsIssuerConfig), // + chip::app::DataModel::List>>( + Id, "triggers", Attributes::Triggers::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "sensitivity", 0, UINT8_MAX, Attributes::Sensitivity::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( @@ -26869,7 +26708,7 @@ void registerClusterZoneManagement(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // make_unique(Id, "supported-zone-sources", Attributes::SupportedZoneSources::Id, credsIssuerConfig), // make_unique(Id, "zones", Attributes::Zones::Id, credsIssuerConfig), // - make_unique(Id, "time-control", Attributes::TimeControl::Id, credsIssuerConfig), // + make_unique(Id, "triggers", Attributes::Triggers::Id, credsIssuerConfig), // make_unique(Id, "sensitivity", Attributes::Sensitivity::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // @@ -26909,10 +26748,6 @@ void registerClusterCameraAvStreamManagement(Commands & commands, CredentialIssu make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // // // Attributes // @@ -26945,33 +26780,29 @@ void registerClusterCameraAvStreamManagement(Commands & commands, CredentialIssu make_unique(Id, "soft-recording-privacy-mode-enabled", Attributes::SoftRecordingPrivacyModeEnabled::Id, credsIssuerConfig), // make_unique(Id, "soft-livestream-privacy-mode-enabled", Attributes::SoftLivestreamPrivacyModeEnabled::Id, - credsIssuerConfig), // - make_unique(Id, "hard-privacy-mode-on", Attributes::HardPrivacyModeOn::Id, credsIssuerConfig), // - make_unique(Id, "night-vision", Attributes::NightVision::Id, credsIssuerConfig), // - make_unique(Id, "night-vision-illum", Attributes::NightVisionIllum::Id, credsIssuerConfig), // - make_unique(Id, "awbenabled", Attributes::AWBEnabled::Id, credsIssuerConfig), // - make_unique(Id, "auto-shutter-speed-enabled", Attributes::AutoShutterSpeedEnabled::Id, credsIssuerConfig), // - make_unique(Id, "auto-isoenabled", Attributes::AutoISOEnabled::Id, credsIssuerConfig), // - make_unique(Id, "viewport", Attributes::Viewport::Id, credsIssuerConfig), // - make_unique(Id, "speaker-muted", Attributes::SpeakerMuted::Id, credsIssuerConfig), // - make_unique(Id, "speaker-volume-level", Attributes::SpeakerVolumeLevel::Id, credsIssuerConfig), // - make_unique(Id, "speaker-max-level", Attributes::SpeakerMaxLevel::Id, credsIssuerConfig), // - make_unique(Id, "speaker-min-level", Attributes::SpeakerMinLevel::Id, credsIssuerConfig), // - make_unique(Id, "microphone-muted", Attributes::MicrophoneMuted::Id, credsIssuerConfig), // - make_unique(Id, "microphone-volume-level", Attributes::MicrophoneVolumeLevel::Id, credsIssuerConfig), // - make_unique(Id, "microphone-max-level", Attributes::MicrophoneMaxLevel::Id, credsIssuerConfig), // - make_unique(Id, "microphone-min-level", Attributes::MicrophoneMinLevel::Id, credsIssuerConfig), // - make_unique(Id, "microphone-agcenabled", Attributes::MicrophoneAGCEnabled::Id, credsIssuerConfig), // - make_unique(Id, "image-rotation", Attributes::ImageRotation::Id, credsIssuerConfig), // - make_unique(Id, "image-flip-horizontal", Attributes::ImageFlipHorizontal::Id, credsIssuerConfig), // - make_unique(Id, "image-flip-vertical", Attributes::ImageFlipVertical::Id, credsIssuerConfig), // + credsIssuerConfig), // + make_unique(Id, "hard-privacy-mode-on", Attributes::HardPrivacyModeOn::Id, credsIssuerConfig), // + make_unique(Id, "night-vision", Attributes::NightVision::Id, credsIssuerConfig), // + make_unique(Id, "night-vision-illum", Attributes::NightVisionIllum::Id, credsIssuerConfig), // + make_unique(Id, "viewport", Attributes::Viewport::Id, credsIssuerConfig), // + make_unique(Id, "speaker-muted", Attributes::SpeakerMuted::Id, credsIssuerConfig), // + make_unique(Id, "speaker-volume-level", Attributes::SpeakerVolumeLevel::Id, credsIssuerConfig), // + make_unique(Id, "speaker-max-level", Attributes::SpeakerMaxLevel::Id, credsIssuerConfig), // + make_unique(Id, "speaker-min-level", Attributes::SpeakerMinLevel::Id, credsIssuerConfig), // + make_unique(Id, "microphone-muted", Attributes::MicrophoneMuted::Id, credsIssuerConfig), // + make_unique(Id, "microphone-volume-level", Attributes::MicrophoneVolumeLevel::Id, credsIssuerConfig), // + make_unique(Id, "microphone-max-level", Attributes::MicrophoneMaxLevel::Id, credsIssuerConfig), // + make_unique(Id, "microphone-min-level", Attributes::MicrophoneMinLevel::Id, credsIssuerConfig), // + make_unique(Id, "microphone-agcenabled", Attributes::MicrophoneAGCEnabled::Id, credsIssuerConfig), // + make_unique(Id, "image-rotation", Attributes::ImageRotation::Id, credsIssuerConfig), // + make_unique(Id, "image-flip-horizontal", Attributes::ImageFlipHorizontal::Id, credsIssuerConfig), // + make_unique(Id, "image-flip-vertical", Attributes::ImageFlipVertical::Id, credsIssuerConfig), // make_unique(Id, "local-video-recording-enabled", Attributes::LocalVideoRecordingEnabled::Id, credsIssuerConfig), // make_unique(Id, "local-snapshot-recording-enabled", Attributes::LocalSnapshotRecordingEnabled::Id, credsIssuerConfig), // make_unique(Id, "status-light-enabled", Attributes::StatusLightEnabled::Id, credsIssuerConfig), // make_unique(Id, "status-light-brightness", Attributes::StatusLightBrightness::Id, credsIssuerConfig), // - make_unique(Id, "depth-sensor-status", Attributes::DepthSensorStatus::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // @@ -27050,38 +26881,32 @@ void registerClusterCameraAvStreamManagement(Commands & commands, CredentialIssu make_unique>( Id, "night-vision-illum", 0, UINT8_MAX, Attributes::NightVisionIllum::Id, WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>(Id, "awbenabled", 0, 1, Attributes::AWBEnabled::Id, WriteCommandType::kWrite, - credsIssuerConfig), // - make_unique>(Id, "auto-shutter-speed-enabled", 0, 1, Attributes::AutoShutterSpeedEnabled::Id, - WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>(Id, "auto-isoenabled", 0, 1, Attributes::AutoISOEnabled::Id, WriteCommandType::kWrite, - credsIssuerConfig), // make_unique>( - Id, "viewport", Attributes::Viewport::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + Id, "viewport", Attributes::Viewport::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "speaker-muted", 0, 1, Attributes::SpeakerMuted::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "speaker-volume-level", 0, UINT8_MAX, Attributes::SpeakerVolumeLevel::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "speaker-max-level", 0, UINT8_MAX, Attributes::SpeakerMaxLevel::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "speaker-min-level", 0, UINT8_MAX, Attributes::SpeakerMinLevel::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "microphone-muted", 0, 1, Attributes::MicrophoneMuted::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "microphone-volume-level", 0, UINT8_MAX, Attributes::MicrophoneVolumeLevel::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "microphone-max-level", 0, UINT8_MAX, Attributes::MicrophoneMaxLevel::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "microphone-min-level", 0, UINT8_MAX, Attributes::MicrophoneMinLevel::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "microphone-agcenabled", 0, 1, Attributes::MicrophoneAGCEnabled::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "image-rotation", 0, UINT16_MAX, Attributes::ImageRotation::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "image-flip-horizontal", 0, 1, Attributes::ImageFlipHorizontal::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "image-flip-vertical", 0, 1, Attributes::ImageFlipVertical::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "local-video-recording-enabled", 0, 1, Attributes::LocalVideoRecordingEnabled::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "local-snapshot-recording-enabled", 0, 1, @@ -27092,9 +26917,6 @@ void registerClusterCameraAvStreamManagement(Commands & commands, CredentialIssu make_unique>( Id, "status-light-brightness", 0, UINT8_MAX, Attributes::StatusLightBrightness::Id, WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>( - Id, "depth-sensor-status", 0, UINT8_MAX, Attributes::DepthSensorStatus::Id, WriteCommandType::kWrite, - credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -27137,14 +26959,10 @@ void registerClusterCameraAvStreamManagement(Commands & commands, CredentialIssu make_unique(Id, "soft-recording-privacy-mode-enabled", Attributes::SoftRecordingPrivacyModeEnabled::Id, credsIssuerConfig), // make_unique(Id, "soft-livestream-privacy-mode-enabled", - Attributes::SoftLivestreamPrivacyModeEnabled::Id, credsIssuerConfig), // - make_unique(Id, "hard-privacy-mode-on", Attributes::HardPrivacyModeOn::Id, credsIssuerConfig), // - make_unique(Id, "night-vision", Attributes::NightVision::Id, credsIssuerConfig), // - make_unique(Id, "night-vision-illum", Attributes::NightVisionIllum::Id, credsIssuerConfig), // - make_unique(Id, "awbenabled", Attributes::AWBEnabled::Id, credsIssuerConfig), // - make_unique(Id, "auto-shutter-speed-enabled", Attributes::AutoShutterSpeedEnabled::Id, - credsIssuerConfig), // - make_unique(Id, "auto-isoenabled", Attributes::AutoISOEnabled::Id, credsIssuerConfig), // + Attributes::SoftLivestreamPrivacyModeEnabled::Id, credsIssuerConfig), // + make_unique(Id, "hard-privacy-mode-on", Attributes::HardPrivacyModeOn::Id, credsIssuerConfig), // + make_unique(Id, "night-vision", Attributes::NightVision::Id, credsIssuerConfig), // + make_unique(Id, "night-vision-illum", Attributes::NightVisionIllum::Id, credsIssuerConfig), // make_unique(Id, "viewport", Attributes::Viewport::Id, credsIssuerConfig), // make_unique(Id, "speaker-muted", Attributes::SpeakerMuted::Id, credsIssuerConfig), // make_unique(Id, "speaker-volume-level", Attributes::SpeakerVolumeLevel::Id, credsIssuerConfig), // @@ -27164,7 +26982,6 @@ void registerClusterCameraAvStreamManagement(Commands & commands, CredentialIssu credsIssuerConfig), // make_unique(Id, "status-light-enabled", Attributes::StatusLightEnabled::Id, credsIssuerConfig), // make_unique(Id, "status-light-brightness", Attributes::StatusLightBrightness::Id, credsIssuerConfig), // - make_unique(Id, "depth-sensor-status", Attributes::DepthSensorStatus::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 670d306354..0c3abfbc83 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -5939,23 +5939,22 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ZoneManagement::Struct ComplexArgumentParser::Finalize(request.zoneSource); } -CHIP_ERROR -ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::Type & request, - Json::Value & value) +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::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("ZoneTriggeringTimeControlStruct.initialDuration", - "initialDuration", value.isMember("initialDuration"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggeringTimeControlStruct.augmentationDuration", + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggerControlStruct.initialDuration", "initialDuration", + value.isMember("initialDuration"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggerControlStruct.augmentationDuration", "augmentationDuration", value.isMember("augmentationDuration"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggeringTimeControlStruct.maxDuration", "maxDuration", + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggerControlStruct.maxDuration", "maxDuration", value.isMember("maxDuration"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggeringTimeControlStruct.blindDuration", "blindDuration", + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ZoneTriggerControlStruct.blindDuration", "blindDuration", value.isMember("blindDuration"))); char labelWithMember[kMaxLabelLength]; @@ -5976,15 +5975,23 @@ ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.blindDuration, value["blindDuration"])); valueCopy.removeMember("blindDuration"); + if (value.isMember("sensitivity")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "sensitivity"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.sensitivity, value["sensitivity"])); + } + valueCopy.removeMember("sensitivity"); + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } -void ComplexArgumentParser::Finalize(chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::Type & request) +void ComplexArgumentParser::Finalize(chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::Type & request) { ComplexArgumentParser::Finalize(request.initialDuration); ComplexArgumentParser::Finalize(request.augmentationDuration); ComplexArgumentParser::Finalize(request.maxDuration); ComplexArgumentParser::Finalize(request.blindDuration); + ComplexArgumentParser::Finalize(request.sensitivity); } CHIP_ERROR diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 38b3aee08f..869fcb855a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -688,11 +688,10 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ZoneManagement: static void Finalize(chip::app::Clusters::ZoneManagement::Structs::ZoneInformationStruct::Type & request); -static CHIP_ERROR Setup(const char * label, - chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::Type & request, +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::Type & request); +static void Finalize(chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::CameraAvStreamManagement::Structs::VideoResolutionStruct::Type & request, 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 ac4e3adbbb..6fb87819ce 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -5246,9 +5246,9 @@ 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::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::DecodableType & value) +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { @@ -5283,6 +5283,14 @@ CHIP_ERROR DataModelLogger::LogValue( return err; } } + { + CHIP_ERROR err = LogValue("Sensitivity", indent + 1, value.sensitivity); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Sensitivity'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -18438,12 +18446,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("Zones", 1, value); } - case ZoneManagement::Attributes::TimeControl::Id: { + case ZoneManagement::Attributes::Triggers::Id: { chip::app::DataModel::DecodableList< - chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::DecodableType> + chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::DecodableType> value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("TimeControl", 1, value); + return DataModelLogger::LogValue("Triggers", 1, value); } case ZoneManagement::Attributes::Sensitivity::Id: { uint8_t value; @@ -18621,21 +18629,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("NightVisionIllum", 1, value); } - case CameraAvStreamManagement::Attributes::AWBEnabled::Id: { - bool value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AWBEnabled", 1, value); - } - case CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id: { - bool value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AutoShutterSpeedEnabled", 1, value); - } - case CameraAvStreamManagement::Attributes::AutoISOEnabled::Id: { - bool value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AutoISOEnabled", 1, value); - } case CameraAvStreamManagement::Attributes::Viewport::Id: { chip::app::Clusters::CameraAvStreamManagement::Structs::ViewportStruct::DecodableType value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -18721,11 +18714,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("StatusLightBrightness", 1, value); } - case CameraAvStreamManagement::Attributes::DepthSensorStatus::Id: { - chip::app::Clusters::CameraAvStreamManagement::TriStateAutoEnum value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("DepthSensorStatus", 1, value); - } case CameraAvStreamManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, 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 c9833ccb6c..dd53dfabc6 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -422,9 +422,8 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ZoneManagement::Structs::ZoneInformationStruct::DecodableType & value); -static CHIP_ERROR -LogValue(const char * label, size_t indent, - const chip::app::Clusters::ZoneManagement::Structs::ZoneTriggeringTimeControlStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::ZoneManagement::Structs::ZoneTriggerControlStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp index caa60d3532..753378db6f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -4148,8 +4148,8 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "SupportedZoneSources"; case chip::app::Clusters::ZoneManagement::Attributes::Zones::Id: return "Zones"; - case chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id: - return "TimeControl"; + case chip::app::Clusters::ZoneManagement::Attributes::Triggers::Id: + return "Triggers"; case chip::app::Clusters::ZoneManagement::Attributes::Sensitivity::Id: return "Sensitivity"; case chip::app::Clusters::ZoneManagement::Attributes::GeneratedCommandList::Id: @@ -4221,12 +4221,6 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "NightVision"; case chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVisionIllum::Id: return "NightVisionIllum"; - case chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id: - return "AWBEnabled"; - case chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id: - return "AutoShutterSpeedEnabled"; - case chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id: - return "AutoISOEnabled"; case chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id: return "Viewport"; case chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id: @@ -4261,8 +4255,6 @@ char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) return "StatusLightEnabled"; case chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightBrightness::Id: return "StatusLightBrightness"; - case chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id: - return "DepthSensorStatus"; case chip::app::Clusters::CameraAvStreamManagement::Attributes::GeneratedCommandList::Id: return "GeneratedCommandList"; case chip::app::Clusters::CameraAvStreamManagement::Attributes::AcceptedCommandList::Id: @@ -5690,14 +5682,6 @@ char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id return "SetStreamPriorities"; case chip::app::Clusters::CameraAvStreamManagement::Commands::CaptureSnapshot::Id: return "CaptureSnapshot"; - case chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Id: - return "SetViewport"; - case chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Id: - return "SetImageRotation"; - case chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Id: - return "SetImageFlipHorizontal"; - case chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Id: - return "SetImageFlipVertical"; default: return "Unknown"; } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index bf6bff38ba..6e8b57d2d8 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -149469,7 +149469,7 @@ class SubscribeAttributeContentAppObserverClusterRevision : public SubscribeAttr | Attributes: | | | * SupportedZoneSources | 0x0000 | | * Zones | 0x0001 | -| * TimeControl | 0x0002 | +| * Triggers | 0x0002 | | * Sensitivity | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | @@ -149934,34 +149934,34 @@ class SubscribeAttributeZoneManagementZones : public SubscribeAttribute { #if MTR_ENABLE_PROVISIONAL /* - * Attribute TimeControl + * Attribute Triggers */ -class ReadZoneManagementTimeControl : public ReadAttribute { +class ReadZoneManagementTriggers : public ReadAttribute { public: - ReadZoneManagementTimeControl() - : ReadAttribute("time-control") + ReadZoneManagementTriggers() + : ReadAttribute("triggers") { } - ~ReadZoneManagementTimeControl() + ~ReadZoneManagementTriggers() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Triggers::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeTimeControlWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ZoneManagement.TimeControl response %@", [value description]); + [cluster readAttributeTriggersWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ZoneManagement.Triggers response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("ZoneManagement TimeControl read Error", error); + LogNSError("ZoneManagement Triggers read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -149970,25 +149970,25 @@ class ReadZoneManagementTimeControl : public ReadAttribute { } }; -class WriteZoneManagementTimeControl : public WriteAttribute { +class WriteZoneManagementTriggers : public WriteAttribute { public: - WriteZoneManagementTimeControl() - : WriteAttribute("time-control") + WriteZoneManagementTriggers() + : WriteAttribute("triggers") , mComplex(&mValue) { - AddArgument("attr-name", "time-control"); + AddArgument("attr-name", "triggers"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } - ~WriteZoneManagementTimeControl() + ~WriteZoneManagementTriggers() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Triggers::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -150000,20 +150000,25 @@ class WriteZoneManagementTimeControl : public WriteAttribute { { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { - MTRZoneManagementClusterZoneTriggeringTimeControlStruct * newElement_0; - newElement_0 = [MTRZoneManagementClusterZoneTriggeringTimeControlStruct new]; + MTRZoneManagementClusterZoneTriggerControlStruct * newElement_0; + newElement_0 = [MTRZoneManagementClusterZoneTriggerControlStruct new]; newElement_0.initialDuration = [NSNumber numberWithUnsignedShort:entry_0.initialDuration]; newElement_0.augmentationDuration = [NSNumber numberWithUnsignedShort:entry_0.augmentationDuration]; newElement_0.maxDuration = [NSNumber numberWithUnsignedInt:entry_0.maxDuration]; newElement_0.blindDuration = [NSNumber numberWithUnsignedShort:entry_0.blindDuration]; + if (entry_0.sensitivity.HasValue()) { + newElement_0.sensitivity = [NSNumber numberWithUnsignedChar:entry_0.sensitivity.Value()]; + } else { + newElement_0.sensitivity = nil; + } [array_0 addObject:newElement_0]; } value = array_0; } - [cluster writeAttributeTimeControlWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeTriggersWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("ZoneManagement TimeControl write Error", error); + LogNSError("ZoneManagement Triggers write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -150022,25 +150027,25 @@ class WriteZoneManagementTimeControl : public WriteAttribute { } private: - chip::app::DataModel::List mValue; - TypedComplexArgument> mComplex; + chip::app::DataModel::List mValue; + TypedComplexArgument> mComplex; }; -class SubscribeAttributeZoneManagementTimeControl : public SubscribeAttribute { +class SubscribeAttributeZoneManagementTriggers : public SubscribeAttribute { public: - SubscribeAttributeZoneManagementTimeControl() - : SubscribeAttribute("time-control") + SubscribeAttributeZoneManagementTriggers() + : SubscribeAttribute("triggers") { } - ~SubscribeAttributeZoneManagementTimeControl() + ~SubscribeAttributeZoneManagementTriggers() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Triggers::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -150055,10 +150060,10 @@ class SubscribeAttributeZoneManagementTimeControl : public SubscribeAttribute { if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeTimeControlWithParams:params + [cluster subscribeAttributeTriggersWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ZoneManagement.TimeControl response %@", [value description]); + NSLog(@"ZoneManagement.Triggers response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -150638,10 +150643,6 @@ class SubscribeAttributeZoneManagementClusterRevision : public SubscribeAttribut | * SnapshotStreamDeallocate | 0x09 | | * SetStreamPriorities | 0x0A | | * CaptureSnapshot | 0x0B | -| * SetViewport | 0x0D | -| * SetImageRotation | 0x0E | -| * SetImageFlipHorizontal | 0x0F | -| * SetImageFlipVertical | 0x10 | |------------------------------------------------------------------------------| | Attributes: | | | * MaxConcurrentVideoEncoders | 0x0000 | @@ -150670,27 +150671,23 @@ class SubscribeAttributeZoneManagementClusterRevision : public SubscribeAttribut | * HardPrivacyModeOn | 0x0017 | | * NightVision | 0x0018 | | * NightVisionIllum | 0x0019 | -| * AWBEnabled | 0x001A | -| * AutoShutterSpeedEnabled | 0x001B | -| * AutoISOEnabled | 0x001C | -| * Viewport | 0x001D | -| * SpeakerMuted | 0x001E | -| * SpeakerVolumeLevel | 0x001F | -| * SpeakerMaxLevel | 0x0020 | -| * SpeakerMinLevel | 0x0021 | -| * MicrophoneMuted | 0x0022 | -| * MicrophoneVolumeLevel | 0x0023 | -| * MicrophoneMaxLevel | 0x0024 | -| * MicrophoneMinLevel | 0x0025 | -| * MicrophoneAGCEnabled | 0x0026 | -| * ImageRotation | 0x0027 | -| * ImageFlipHorizontal | 0x0028 | -| * ImageFlipVertical | 0x0029 | -| * LocalVideoRecordingEnabled | 0x002A | -| * LocalSnapshotRecordingEnabled | 0x002B | -| * StatusLightEnabled | 0x002C | -| * StatusLightBrightness | 0x002D | -| * DepthSensorStatus | 0x002E | +| * Viewport | 0x001A | +| * SpeakerMuted | 0x001B | +| * SpeakerVolumeLevel | 0x001C | +| * SpeakerMaxLevel | 0x001D | +| * SpeakerMinLevel | 0x001E | +| * MicrophoneMuted | 0x001F | +| * MicrophoneVolumeLevel | 0x0020 | +| * MicrophoneMaxLevel | 0x0021 | +| * MicrophoneMinLevel | 0x0022 | +| * MicrophoneAGCEnabled | 0x0023 | +| * ImageRotation | 0x0024 | +| * ImageFlipHorizontal | 0x0025 | +| * ImageFlipVertical | 0x0026 | +| * LocalVideoRecordingEnabled | 0x0027 | +| * LocalSnapshotRecordingEnabled | 0x0028 | +| * StatusLightEnabled | 0x0029 | +| * StatusLightBrightness | 0x002A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -151401,224 +151398,6 @@ class CameraAvStreamManagementCaptureSnapshot : public ClusterCommand { TypedComplexArgument mComplex_RequestedResolution; }; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetViewport - */ -class CameraAvStreamManagementSetViewport : public ClusterCommand { -public: - CameraAvStreamManagementSetViewport() - : ClusterCommand("set-viewport") - , mComplex_Viewport(&mRequest.viewport) - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("Viewport", &mComplex_Viewport); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRCameraAVStreamManagementClusterSetViewportParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.viewport = [MTRCameraAVStreamManagementClusterViewportStruct new]; - params.viewport.x1 = [NSNumber numberWithUnsignedShort:mRequest.viewport.x1]; - params.viewport.y1 = [NSNumber numberWithUnsignedShort:mRequest.viewport.y1]; - params.viewport.x2 = [NSNumber numberWithUnsignedShort:mRequest.viewport.x2]; - params.viewport.y2 = [NSNumber numberWithUnsignedShort:mRequest.viewport.y2]; -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setViewportWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Type mRequest; - TypedComplexArgument mComplex_Viewport; -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetImageRotation - */ -class CameraAvStreamManagementSetImageRotation : public ClusterCommand { -public: - CameraAvStreamManagementSetImageRotation() - : ClusterCommand("set-image-rotation") - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("Angle", 0, UINT16_MAX, &mRequest.angle); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRCameraAVStreamManagementClusterSetImageRotationParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.angle = [NSNumber numberWithUnsignedShort:mRequest.angle]; -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setImageRotationWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Type mRequest; -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetImageFlipHorizontal - */ -class CameraAvStreamManagementSetImageFlipHorizontal : public ClusterCommand { -public: - CameraAvStreamManagementSetImageFlipHorizontal() - : ClusterCommand("set-image-flip-horizontal") - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("Enabled", 0, 1, &mRequest.enabled); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.enabled = [NSNumber numberWithBool:mRequest.enabled]; -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setImageFlipHorizontalWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Type mRequest; -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetImageFlipVertical - */ -class CameraAvStreamManagementSetImageFlipVertical : public ClusterCommand { -public: - CameraAvStreamManagementSetImageFlipVertical() - : ClusterCommand("set-image-flip-vertical") - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("Enabled", 0, 1, &mRequest.enabled); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.enabled = [NSNumber numberWithBool:mRequest.enabled]; -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setImageFlipVerticalWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Type mRequest; -}; - #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -154091,34 +153870,34 @@ class SubscribeAttributeCameraAvStreamManagementNightVisionIllum : public Subscr #if MTR_ENABLE_PROVISIONAL /* - * Attribute AWBEnabled + * Attribute Viewport */ -class ReadCameraAvStreamManagementAWBEnabled : public ReadAttribute { +class ReadCameraAvStreamManagementViewport : public ReadAttribute { public: - ReadCameraAvStreamManagementAWBEnabled() - : ReadAttribute("awbenabled") + ReadCameraAvStreamManagementViewport() + : ReadAttribute("viewport") { } - ~ReadCameraAvStreamManagementAWBEnabled() + ~ReadCameraAvStreamManagementViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAWBEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.AWBEnabled response %@", [value description]); + [cluster readAttributeViewportWithCompletion:^(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"CameraAVStreamManagement.Viewport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("CameraAVStreamManagement AWBEnabled read Error", error); + LogNSError("CameraAVStreamManagement Viewport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -154127,24 +153906,25 @@ class ReadCameraAvStreamManagementAWBEnabled : public ReadAttribute { } }; -class WriteCameraAvStreamManagementAWBEnabled : public WriteAttribute { +class WriteCameraAvStreamManagementViewport : public WriteAttribute { public: - WriteCameraAvStreamManagementAWBEnabled() - : WriteAttribute("awbenabled") + WriteCameraAvStreamManagementViewport() + : WriteAttribute("viewport") + , mComplex(&mValue) { - AddArgument("attr-name", "awbenabled"); - AddArgument("attr-value", 0, 1, &mValue); + AddArgument("attr-name", "viewport"); + AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } - ~WriteCameraAvStreamManagementAWBEnabled() + ~WriteCameraAvStreamManagementViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -154152,11 +153932,16 @@ class WriteCameraAvStreamManagementAWBEnabled : public WriteAttribute { __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeAWBEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { + MTRCameraAVStreamManagementClusterViewportStruct * _Nonnull value; + value = [MTRCameraAVStreamManagementClusterViewportStruct new]; + value.x1 = [NSNumber numberWithUnsignedShort:mValue.x1]; + value.y1 = [NSNumber numberWithUnsignedShort:mValue.y1]; + value.x2 = [NSNumber numberWithUnsignedShort:mValue.x2]; + value.y2 = [NSNumber numberWithUnsignedShort:mValue.y2]; + + [cluster writeAttributeViewportWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("CameraAVStreamManagement AWBEnabled write Error", error); + LogNSError("CameraAVStreamManagement Viewport write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -154165,24 +153950,25 @@ class WriteCameraAvStreamManagementAWBEnabled : public WriteAttribute { } private: - bool mValue; + chip::app::Clusters::CameraAvStreamManagement::Structs::ViewportStruct::Type mValue; + TypedComplexArgument mComplex; }; -class SubscribeAttributeCameraAvStreamManagementAWBEnabled : public SubscribeAttribute { +class SubscribeAttributeCameraAvStreamManagementViewport : public SubscribeAttribute { public: - SubscribeAttributeCameraAvStreamManagementAWBEnabled() - : SubscribeAttribute("awbenabled") + SubscribeAttributeCameraAvStreamManagementViewport() + : SubscribeAttribute("viewport") { } - ~SubscribeAttributeCameraAvStreamManagementAWBEnabled() + ~SubscribeAttributeCameraAvStreamManagementViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -154197,10 +153983,10 @@ class SubscribeAttributeCameraAvStreamManagementAWBEnabled : public SubscribeAtt if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeAWBEnabledWithParams:params + [cluster subscribeAttributeViewportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.AWBEnabled response %@", [value description]); + reportHandler:^(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"CameraAVStreamManagement.Viewport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -154217,34 +154003,34 @@ class SubscribeAttributeCameraAvStreamManagementAWBEnabled : public SubscribeAtt #if MTR_ENABLE_PROVISIONAL /* - * Attribute AutoShutterSpeedEnabled + * Attribute SpeakerMuted */ -class ReadCameraAvStreamManagementAutoShutterSpeedEnabled : public ReadAttribute { +class ReadCameraAvStreamManagementSpeakerMuted : public ReadAttribute { public: - ReadCameraAvStreamManagementAutoShutterSpeedEnabled() - : ReadAttribute("auto-shutter-speed-enabled") + ReadCameraAvStreamManagementSpeakerMuted() + : ReadAttribute("speaker-muted") { } - ~ReadCameraAvStreamManagementAutoShutterSpeedEnabled() + ~ReadCameraAvStreamManagementSpeakerMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAutoShutterSpeedEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.AutoShutterSpeedEnabled response %@", [value description]); + [cluster readAttributeSpeakerMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CameraAVStreamManagement.SpeakerMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("CameraAVStreamManagement AutoShutterSpeedEnabled read Error", error); + LogNSError("CameraAVStreamManagement SpeakerMuted read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -154253,24 +154039,24 @@ class ReadCameraAvStreamManagementAutoShutterSpeedEnabled : public ReadAttribute } }; -class WriteCameraAvStreamManagementAutoShutterSpeedEnabled : public WriteAttribute { +class WriteCameraAvStreamManagementSpeakerMuted : public WriteAttribute { public: - WriteCameraAvStreamManagementAutoShutterSpeedEnabled() - : WriteAttribute("auto-shutter-speed-enabled") + WriteCameraAvStreamManagementSpeakerMuted() + : WriteAttribute("speaker-muted") { - AddArgument("attr-name", "auto-shutter-speed-enabled"); + AddArgument("attr-name", "speaker-muted"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } - ~WriteCameraAvStreamManagementAutoShutterSpeedEnabled() + ~WriteCameraAvStreamManagementSpeakerMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -154280,9 +154066,9 @@ class WriteCameraAvStreamManagementAutoShutterSpeedEnabled : public WriteAttribu params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - [cluster writeAttributeAutoShutterSpeedEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeSpeakerMutedWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("CameraAVStreamManagement AutoShutterSpeedEnabled write Error", error); + LogNSError("CameraAVStreamManagement SpeakerMuted write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -154294,21 +154080,21 @@ class WriteCameraAvStreamManagementAutoShutterSpeedEnabled : public WriteAttribu bool mValue; }; -class SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled : public SubscribeAttribute { +class SubscribeAttributeCameraAvStreamManagementSpeakerMuted : public SubscribeAttribute { public: - SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled() - : SubscribeAttribute("auto-shutter-speed-enabled") + SubscribeAttributeCameraAvStreamManagementSpeakerMuted() + : SubscribeAttribute("speaker-muted") { } - ~SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled() + ~SubscribeAttributeCameraAvStreamManagementSpeakerMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -154323,10 +154109,10 @@ class SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled : public if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeAutoShutterSpeedEnabledWithParams:params + [cluster subscribeAttributeSpeakerMutedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.AutoShutterSpeedEnabled response %@", [value description]); + NSLog(@"CameraAVStreamManagement.SpeakerMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -154343,34 +154129,34 @@ class SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled : public #if MTR_ENABLE_PROVISIONAL /* - * Attribute AutoISOEnabled + * Attribute SpeakerVolumeLevel */ -class ReadCameraAvStreamManagementAutoISOEnabled : public ReadAttribute { +class ReadCameraAvStreamManagementSpeakerVolumeLevel : public ReadAttribute { public: - ReadCameraAvStreamManagementAutoISOEnabled() - : ReadAttribute("auto-isoenabled") + ReadCameraAvStreamManagementSpeakerVolumeLevel() + : ReadAttribute("speaker-volume-level") { } - ~ReadCameraAvStreamManagementAutoISOEnabled() + ~ReadCameraAvStreamManagementSpeakerVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeAutoISOEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.AutoISOEnabled response %@", [value description]); + [cluster readAttributeSpeakerVolumeLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CameraAVStreamManagement.SpeakerVolumeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("CameraAVStreamManagement AutoISOEnabled read Error", error); + LogNSError("CameraAVStreamManagement SpeakerVolumeLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -154379,24 +154165,24 @@ class ReadCameraAvStreamManagementAutoISOEnabled : public ReadAttribute { } }; -class WriteCameraAvStreamManagementAutoISOEnabled : public WriteAttribute { +class WriteCameraAvStreamManagementSpeakerVolumeLevel : public WriteAttribute { public: - WriteCameraAvStreamManagementAutoISOEnabled() - : WriteAttribute("auto-isoenabled") + WriteCameraAvStreamManagementSpeakerVolumeLevel() + : WriteAttribute("speaker-volume-level") { - AddArgument("attr-name", "auto-isoenabled"); - AddArgument("attr-value", 0, 1, &mValue); + AddArgument("attr-name", "speaker-volume-level"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } - ~WriteCameraAvStreamManagementAutoISOEnabled() + ~WriteCameraAvStreamManagementSpeakerVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -154404,11 +154190,11 @@ class WriteCameraAvStreamManagementAutoISOEnabled : public WriteAttribute { __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - [cluster writeAttributeAutoISOEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeSpeakerVolumeLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("CameraAVStreamManagement AutoISOEnabled write Error", error); + LogNSError("CameraAVStreamManagement SpeakerVolumeLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -154417,24 +154203,24 @@ class WriteCameraAvStreamManagementAutoISOEnabled : public WriteAttribute { } private: - bool mValue; + uint8_t mValue; }; -class SubscribeAttributeCameraAvStreamManagementAutoISOEnabled : public SubscribeAttribute { +class SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel : public SubscribeAttribute { public: - SubscribeAttributeCameraAvStreamManagementAutoISOEnabled() - : SubscribeAttribute("auto-isoenabled") + SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel() + : SubscribeAttribute("speaker-volume-level") { } - ~SubscribeAttributeCameraAvStreamManagementAutoISOEnabled() + ~SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); @@ -154449,10 +154235,10 @@ class SubscribeAttributeCameraAvStreamManagementAutoISOEnabled : public Subscrib if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeAutoISOEnabledWithParams:params + [cluster subscribeAttributeSpeakerVolumeLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.AutoISOEnabled response %@", [value description]); + NSLog(@"CameraAVStreamManagement.SpeakerVolumeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -154469,344 +154255,7 @@ class SubscribeAttributeCameraAvStreamManagementAutoISOEnabled : public Subscrib #if MTR_ENABLE_PROVISIONAL /* - * Attribute Viewport - */ -class ReadCameraAvStreamManagementViewport : public ReadAttribute { -public: - ReadCameraAvStreamManagementViewport() - : ReadAttribute("viewport") - { - } - - ~ReadCameraAvStreamManagementViewport() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeViewportWithCompletion:^(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.Viewport response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("CameraAVStreamManagement Viewport read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeCameraAvStreamManagementViewport : public SubscribeAttribute { -public: - SubscribeAttributeCameraAvStreamManagementViewport() - : SubscribeAttribute("viewport") - { - } - - ~SubscribeAttributeCameraAvStreamManagementViewport() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeAutomatically = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeViewportWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.Viewport response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - -/* - * Attribute SpeakerMuted - */ -class ReadCameraAvStreamManagementSpeakerMuted : public ReadAttribute { -public: - ReadCameraAvStreamManagementSpeakerMuted() - : ReadAttribute("speaker-muted") - { - } - - ~ReadCameraAvStreamManagementSpeakerMuted() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSpeakerMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.SpeakerMuted response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("CameraAVStreamManagement SpeakerMuted read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteCameraAvStreamManagementSpeakerMuted : public WriteAttribute { -public: - WriteCameraAvStreamManagementSpeakerMuted() - : WriteAttribute("speaker-muted") - { - AddArgument("attr-name", "speaker-muted"); - AddArgument("attr-value", 0, 1, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementSpeakerMuted() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; - - [cluster writeAttributeSpeakerMutedWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement SpeakerMuted write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - bool mValue; -}; - -class SubscribeAttributeCameraAvStreamManagementSpeakerMuted : public SubscribeAttribute { -public: - SubscribeAttributeCameraAvStreamManagementSpeakerMuted() - : SubscribeAttribute("speaker-muted") - { - } - - ~SubscribeAttributeCameraAvStreamManagementSpeakerMuted() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeAutomatically = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSpeakerMutedWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.SpeakerMuted response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - -/* - * Attribute SpeakerVolumeLevel - */ -class ReadCameraAvStreamManagementSpeakerVolumeLevel : public ReadAttribute { -public: - ReadCameraAvStreamManagementSpeakerVolumeLevel() - : ReadAttribute("speaker-volume-level") - { - } - - ~ReadCameraAvStreamManagementSpeakerVolumeLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeSpeakerVolumeLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.SpeakerVolumeLevel response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("CameraAVStreamManagement SpeakerVolumeLevel read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteCameraAvStreamManagementSpeakerVolumeLevel : public WriteAttribute { -public: - WriteCameraAvStreamManagementSpeakerVolumeLevel() - : WriteAttribute("speaker-volume-level") - { - AddArgument("attr-name", "speaker-volume-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementSpeakerVolumeLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSpeakerVolumeLevelWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement SpeakerVolumeLevel write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel : public SubscribeAttribute { -public: - SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel() - : SubscribeAttribute("speaker-volume-level") - { - } - - ~SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeAutomatically = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeSpeakerVolumeLevelWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.SpeakerVolumeLevel response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - -/* - * Attribute SpeakerMaxLevel + * Attribute SpeakerMaxLevel */ class ReadCameraAvStreamManagementSpeakerMaxLevel : public ReadAttribute { public: @@ -154842,47 +154291,6 @@ class ReadCameraAvStreamManagementSpeakerMaxLevel : public ReadAttribute { } }; -class WriteCameraAvStreamManagementSpeakerMaxLevel : public WriteAttribute { -public: - WriteCameraAvStreamManagementSpeakerMaxLevel() - : WriteAttribute("speaker-max-level") - { - AddArgument("attr-name", "speaker-max-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementSpeakerMaxLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMaxLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSpeakerMaxLevelWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement SpeakerMaxLevel write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - class SubscribeAttributeCameraAvStreamManagementSpeakerMaxLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerMaxLevel() @@ -154968,47 +154376,6 @@ class ReadCameraAvStreamManagementSpeakerMinLevel : public ReadAttribute { } }; -class WriteCameraAvStreamManagementSpeakerMinLevel : public WriteAttribute { -public: - WriteCameraAvStreamManagementSpeakerMinLevel() - : WriteAttribute("speaker-min-level") - { - AddArgument("attr-name", "speaker-min-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementSpeakerMinLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMinLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeSpeakerMinLevelWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement SpeakerMinLevel write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - class SubscribeAttributeCameraAvStreamManagementSpeakerMinLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerMinLevel() @@ -155342,49 +154709,8 @@ class ReadCameraAvStreamManagementMicrophoneMaxLevel : public ReadAttribute { } SetCommandExitStatus(error); }]; - return CHIP_NO_ERROR; - } -}; - -class WriteCameraAvStreamManagementMicrophoneMaxLevel : public WriteAttribute { -public: - WriteCameraAvStreamManagementMicrophoneMaxLevel() - : WriteAttribute("microphone-max-level") - { - AddArgument("attr-name", "microphone-max-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementMicrophoneMaxLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMaxLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeMicrophoneMaxLevelWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement MicrophoneMaxLevel write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; + return CHIP_NO_ERROR; + } }; class SubscribeAttributeCameraAvStreamManagementMicrophoneMaxLevel : public SubscribeAttribute { @@ -155472,47 +154798,6 @@ class ReadCameraAvStreamManagementMicrophoneMinLevel : public ReadAttribute { } }; -class WriteCameraAvStreamManagementMicrophoneMinLevel : public WriteAttribute { -public: - WriteCameraAvStreamManagementMicrophoneMinLevel() - : WriteAttribute("microphone-min-level") - { - AddArgument("attr-name", "microphone-min-level"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementMicrophoneMinLevel() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMinLevel::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeMicrophoneMinLevelWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement MicrophoneMinLevel write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - class SubscribeAttributeCameraAvStreamManagementMicrophoneMinLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneMinLevel() @@ -155724,6 +155009,47 @@ class ReadCameraAvStreamManagementImageRotation : public ReadAttribute { } }; +class WriteCameraAvStreamManagementImageRotation : public WriteAttribute { +public: + WriteCameraAvStreamManagementImageRotation() + : WriteAttribute("image-rotation") + { + AddArgument("attr-name", "image-rotation"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteCameraAvStreamManagementImageRotation() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageRotation::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeImageRotationWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("CameraAVStreamManagement ImageRotation write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + uint16_t mValue; +}; + class SubscribeAttributeCameraAvStreamManagementImageRotation : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementImageRotation() @@ -155809,6 +155135,47 @@ class ReadCameraAvStreamManagementImageFlipHorizontal : public ReadAttribute { } }; +class WriteCameraAvStreamManagementImageFlipHorizontal : public WriteAttribute { +public: + WriteCameraAvStreamManagementImageFlipHorizontal() + : WriteAttribute("image-flip-horizontal") + { + AddArgument("attr-name", "image-flip-horizontal"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteCameraAvStreamManagementImageFlipHorizontal() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageFlipHorizontal::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster writeAttributeImageFlipHorizontalWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("CameraAVStreamManagement ImageFlipHorizontal write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + bool mValue; +}; + class SubscribeAttributeCameraAvStreamManagementImageFlipHorizontal : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementImageFlipHorizontal() @@ -155894,6 +155261,47 @@ class ReadCameraAvStreamManagementImageFlipVertical : public ReadAttribute { } }; +class WriteCameraAvStreamManagementImageFlipVertical : public WriteAttribute { +public: + WriteCameraAvStreamManagementImageFlipVertical() + : WriteAttribute("image-flip-vertical") + { + AddArgument("attr-name", "image-flip-vertical"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteCameraAvStreamManagementImageFlipVertical() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageFlipVertical::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); + __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster writeAttributeImageFlipVerticalWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("CameraAVStreamManagement ImageFlipVertical write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + bool mValue; +}; + class SubscribeAttributeCameraAvStreamManagementImageFlipVertical : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementImageFlipVertical() @@ -156446,132 +155854,6 @@ class SubscribeAttributeCameraAvStreamManagementStatusLightBrightness : public S #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute DepthSensorStatus - */ -class ReadCameraAvStreamManagementDepthSensorStatus : public ReadAttribute { -public: - ReadCameraAvStreamManagementDepthSensorStatus() - : ReadAttribute("depth-sensor-status") - { - } - - ~ReadCameraAvStreamManagementDepthSensorStatus() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeDepthSensorStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.DepthSensorStatus response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("CameraAVStreamManagement DepthSensorStatus read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class WriteCameraAvStreamManagementDepthSensorStatus : public WriteAttribute { -public: - WriteCameraAvStreamManagementDepthSensorStatus() - : WriteAttribute("depth-sensor-status") - { - AddArgument("attr-name", "depth-sensor-status"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); - WriteAttribute::AddArguments(); - } - - ~WriteCameraAvStreamManagementDepthSensorStatus() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRWriteParams alloc] init]; - params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - - [cluster writeAttributeDepthSensorStatusWithValue:value params:params completion:^(NSError * _Nullable error) { - if (error != nil) { - LogNSError("CameraAVStreamManagement DepthSensorStatus write Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } - -private: - uint8_t mValue; -}; - -class SubscribeAttributeCameraAvStreamManagementDepthSensorStatus : public SubscribeAttribute { -public: - SubscribeAttributeCameraAvStreamManagementDepthSensorStatus() - : SubscribeAttribute("depth-sensor-status") - { - } - - ~SubscribeAttributeCameraAvStreamManagementDepthSensorStatus() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; - if (mKeepSubscriptions.HasValue()) { - params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); - } - if (mFabricFiltered.HasValue()) { - params.filterByFabric = mFabricFiltered.Value(); - } - if (mAutoResubscribe.HasValue()) { - params.resubscribeAutomatically = mAutoResubscribe.Value(); - } - [cluster subscribeAttributeDepthSensorStatusWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"CameraAVStreamManagement.DepthSensorStatus response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - - return CHIP_NO_ERROR; - } -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - /* * Attribute GeneratedCommandList */ @@ -181872,9 +181154,9 @@ void registerClusterZoneManagement(Commands & commands) make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // @@ -181943,18 +181225,6 @@ void registerClusterCameraAvStreamManagement(Commands & commands) #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // @@ -182069,23 +181339,9 @@ void registerClusterCameraAvStreamManagement(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // + make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -182100,12 +181356,10 @@ void registerClusterCameraAvStreamManagement(Commands & commands) #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // - make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // - make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -182120,12 +181374,10 @@ void registerClusterCameraAvStreamManagement(Commands & commands) #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // - make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // - make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -182135,14 +181387,17 @@ void registerClusterCameraAvStreamManagement(Commands & commands) #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // + make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // + make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // + make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -182165,11 +181420,6 @@ void registerClusterCameraAvStreamManagement(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), //